• Resolved rwwood

    (@rwwood)


    If I use the admin interface to add widgets to the default sidebar.php, all my other page specific sidebars are disabled and use only sidebar.php. If all widgets are removed from the default sidebar, the other sidebars (category and single) work as expected.

    I’m not sure where to start to look for the problem.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m not sure where to start to look for the problem.

    for instance in sidebar.php ?

    https://codex.www.ads-software.com/Function_Reference/dynamic_sidebar

    Thread Starter rwwood

    (@rwwood)

    I’ve read over and tried everything there and related, however I think the problem is related to the fact that I originally combined some of the twenty ten theme with another (Chocotheme).

    This is what I have in the top of the sidebar.php and functions.php

    <div id="sidebar">
    	<ul>
    		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    			<li>
    				<?php get_search_form(); ?>
    			</li>
    
    			<?php if ( is_404() || is_category() || is_day() || is_month() ||
    						is_year() || is_search() || is_paged() ) {
    			?> <li class="metaplace">
    
    etc.
    function rww_widgets_init() {
    	// Default Sidebar.
    register_sidebar(array(
        'name' => 'sidebar',
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
    
    	// Category Sidebar.
    register_sidebar(array(
        'name' => 'sidebar-category-sidebar',
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
    
    	// Single Post Sidebar.
    register_sidebar(array(
        'name' => 'sidebar-single',
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
    }
    /** Register sidebars by running rww_widgets_init() on the widgets_init hook. */
    add_action( 'widgets_init', 'rww_widgets_init' );

    Not sure that helps.

    in sidebar.php, everything from:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    to the corresponding

    <?php endif; ?>

    will not get executed if any widgets are used.

    Thread Starter rwwood

    (@rwwood)

    I figured out the problems from this post and made the corrections.

    Thanks for you suggestions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘adding widgets to sidebar.php disables page specific sidebars’ is closed to new replies.