WordPress widget/sidebar dividers?
‘after_widget’ => ”, As far as I know, thats the best way to do it
‘after_widget’ => ”, As far as I know, thats the best way to do it
Thanks to Milo and G.M. for pointing to the master key, as G.M. said: you have to use a lower priority than one register_sidebar runs, but lower priority means higher number. So the final code that is working: function site_unregister_sidebar() { if ( is_admin() && current_user_can(‘editor’) ) { unregister_sidebar( ‘my_custom_widget_area’ ); } } add_action(‘widgets_init’, ‘site_unregister_sidebar’, … Read more
the ID of sidebar (in php function) should be LOWERCASE!!!!!!!!!!!
The sidebar description runs through esc_html(), so you cannot pass HTML directly. But you can use the filter esc_html to insert your desired content. Here is a simple example: add_action( ‘widgets_init’, function() { $desc = “Read the <a href=”http://wordpress.stackexchange.com/q/189749/73″>explanation</a>!”; $placeholder=”PLACEHOLDER”; register_sidebar([ ‘id’ => ‘wpse-189749’, ‘name’ => ‘Link description’, ‘description’ => $placeholder ]); add_action( ‘widgets_admin_page’, function() … Read more
Your have created three sidebars and that are primary_widget_area, secondary_widget_area, footer_widget_area But in the sidebar, you call a different sidebar name sidebar-3; that’s why your sidebars are not displaying. Try the following code in sidebar.php: // To display primary_widget_area sidebar <?php if ( is_active_sidebar( ‘primary_widget_area’ ) ) : ?> <?php dynamic_sidebar( ‘primary_widget_area’ ); ?> <?php … Read more
The limitation is down to the existing arguments and how pretty much all widgets typically output content: echo $args[‘before_widget’]; if ( $title ) { echo $args[‘before_title’] . $title . $args[‘after_title’]; } // Widget content echo $args[‘after_widget’]; Some widgets may offer before/after content hooks, but if you want a “global” fix there’s no surefire way around … Read more
Twenty Eleven and Twenty Twelve use the widgets_init action. Given that these themes are generally considered to use best practices for theme development, I think this hook would be ideal.
I installed w3 total cache plugin and cleared my browser cache. Wish I had of done this pre deleting some forms!
First you will replace this line <div id=”%1$s” class=”widget %2$s” data-custom-title=””> with <div id=”%1$s” class=”widget %2$s” data-custom-title=”DCT”> Now add the filter in your functions.php file. add_filter( ‘widget_display_callback’, ‘add_custom_data_to_before_widget’, 10, 3 ); function add_custom_data_to_before_widget( $instance, $widget_class, $args ) { if ( ! empty( $instance[‘title’] ) && ! empty( $instance[‘custom-title’] )) { $args[‘before_widget’] = str_replace(‘DCT’, sanitize_text_field ( … Read more
Removing custom widget area WordPress 4.4 [closed]