• Resolved redgoatcreative

    (@redgoatcreative)


    Basically I tried to setup separate sidebars for specific pages on a site. In the widgets cp I see the sidebars listed and can add widgets which then appear on the page. However when I return to the widgets cp all of the widgets are gone from the sidebars. Here’s the code I used:

    functions.php

    if ( function_exists('register_sidebar') ) {
    	register_sidebar( array(
            'name' => ('Main Sidebar'),
            'id' => 'sidebarMain',
            'description' =>  ('Main site sidebar (default'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    	register_sidebar( array(
            'name' => ('Homepage Sidebar'),
            'id' => 'sidebarHomepage',
            'description' => ('Use to create 3 column layout on homepage.'),
            'before_widget' => '<div class="hpColumn %1$s">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ) );
    	register_sidebar( array(
            'name' => ('Contact Sidebar'),
            'id' => 'sidebarContact',
            'description' => ('Use for contact form.'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    	register_sidebar( array(
            'name' => ('Blog Sidebar'),
            'id' => 'sidebarBlog',
            'description' => ('Use for contact blog.'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    
    }

    On a specific template page (contact) I have:
    get_sidebar( 'contact' );

    and then have
    sidebar-contact.php

    <?php 	/* Widgetized sidebar, if you have the plugin installed. */
    					if ( function_exists('dynamic_sidebar') || dynamic_sidebar('Contact Sidebar') ) : ?>
    			<?php endif; ?>

    Any help would be appreciated.

The topic ‘multiple sidebars problem’ is closed to new replies.