finding sidebar content in wordpress

The content for a dynamic sidebar is whatever widgets are added to that sidebar from the backend. Look at wp-admin->Appearance->Widgets. The actual code for those widgets could come from WordPress itself, a plugin, or your theme. But… The content that i am interested in goes inbetween the < div class=”visual”> and the < div class=”visual-holder”> … Read more

Widget title markup in register_sidebar

If that is all of your “title” code, you aren’t echoing $before_title and $after_title. Look at how the default text widget, which you reference, does it: 399 function widget( $args, $instance ) { 400 extract($args); 401 $title = apply_filters( ‘widget_title’, empty( $instance[‘title’] ) ? ” : $instance[‘title’], $instance, $this->id_base ); 402 $text = apply_filters( ‘widget_text’, … Read more

How to pass a special CSS class into widget li

function widget_display_callback( $params ) { global $wp_registered_widgets; global $my_widget_num; // Global a counter array $id = $params[0][‘widget_id’]; $sidebar_id = $params[0][‘id’]; /* Set some count for each widgets */ if( !$my_widget_num ) { // If the counter array doesn’t exist, create it $my_widget_num = array(); } if( isset( $my_widget_num[ $sidebar_id ] ) ) { // See … Read more

Dynamic sidebar rendered in another place than i would like

You shouldn’t save dynamic_sidebar in a variable because it always echoes out the widget. the following should work. <?php echo ‘<div class=”row-container”> <div class=”row row-parent’ . $row_classes . $limit_content_width . ‘”> <div class=”row-inner”>’; if(($layout === ‘sidebar_right’) && is_active_sidebar( ‘sidebar-messages-single’ )) { dynamic_sidebar( ‘sidebar-messages-single’ ); } echo ‘<div class=”col-lg-‘ . $sidebar_size . ‘”> <div class=”uncol style-‘ … Read more

Sidebar widget not displaying after simple code update.

If you don’t need the others settings from register_sidebar, that’s fine. That’s not fine. 🙂 To render your sidebar you need to call dynamic_sidebar($index); In your case it would be: dynamic_sidebar(‘Right Sidebar’); see the codex page for dynamic sidebar http://codex.wordpress.org/Function_Reference/dynamic_sidebar Your current code says (short version): If there is no sidebar, then do my custom … Read more

Add #sidebar-2 to a custom page template

Instead of calling get_sidebar() call get_sidebar( ‘somethingelse’ );. It will attempt to load sidebar-somethingelse.php and if that doesn’t exist it will load sidebar.php. You can then modify the sidebar-somethingelse.php to load a different sidebar etc I strongly recommend you look up how the template hierarchy works.