Title: Sidebar Code Help
Last modified: August 21, 2016

---

# Sidebar Code Help

 *  [Ty](https://wordpress.org/support/users/grvtyler/)
 * (@grvtyler)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/sidebar-code-help/)
 * Hello All,
    I have looked over the following code many times, and can’t find 
   what I’m missing to allow each sidebar to operate independently. The code below
   is from my about page. The problem is every page is still loading the main default
   sidebar, the widgets in the About sidebar area are not showing up. Any help spotting
   the coding error causing the problem would be great!
 * sidebar-about.php
 *     ```
       <div id="rightsidebar">
   
       	<div id="widgets-wrap-sidebar">
   
            <?php
             if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('about-sidebar') ) :
             endif; ?>
   
           </div>    
   
       </div><!-- rightsidebar end -->
       ```
   
 * About Page Template
 *     ```
       <?php get_header(); ?>
   
       <div id="contentwrap">
   
       <div id="leftcontent">
   
       		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       		<?php the_content(); ?>
   
       		<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
   
       		<?php endwhile; endif; ?>
   
       </div><!-- leftcontent -->
   
       <?php get_sidebar('about-sidebar'); ?>
   
       </div><!-- contentwrap -->
   
       <?php get_footer(); ?>
       ```
   
 * Functions Code
 *     ```
       // Custom Sidebars
       			if ( function_exists('register_sidebar') ) {
       		register_sidebar(array(
       		'before_widget' => '<div id="%1$s" class="widget-sidebar %2$s">',
       		'after_widget' => '</div>',
       		'before_title' => '<h3 class="widget-title">',
       		'after_title' => '</h3 class="widget-title">',
       		));
       		}
       		if ( function_exists('register_sidebar') ) {
       		register_sidebar(array(
       		'name' => 'Homepage Sidebar',
       		'id' => 'homepage-sidebar',
       		'description' => 'Homepage Sidebar',
       		'before_widget' => '<div id="%1$s" class="widget-sidebar %2$s">',
       		'after_widget' => '</div>',
       		'before_title' => '<h3 class="widget-title">',
       		'after_title' => '</h3 class="widget-title">',
       		));
       		}
   
       		register_sidebar(array(
       		'name' => 'About Sidebar',
       		'id' => 'about-sidebar',
       		'description' => 'About Sidebar',
       		'before_widget' => '<div id="%1$s" class="widget-sidebar %2$s">',
       		'after_widget' => '</div>',
       		'before_title' => '<h3 class="widget-title">',
       		'after_title' => '</h3 class="widget-title">',
       		));
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/sidebar-code-help/#post-4637294)
 * this line `<?php get_sidebar('about-sidebar'); ?>` tries to call a file **_‘sidebar-
   about-sidebar.php’_** which might not exist, and then goes to the default sidebar.
   php;
 * as you posted yourself, your sidebar file name seems to be **_‘sidebar-about.
   php’_** which would need to be called by this code `<?php get_sidebar('about);?
   >` – [http://codex.wordpress.org/Function_Reference/get_sidebar](http://codex.wordpress.org/Function_Reference/get_sidebar)
 * I haven’t checked any other code of your post so far…
 *  Thread Starter [Ty](https://wordpress.org/support/users/grvtyler/)
 * (@grvtyler)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/sidebar-code-help/#post-4637302)
 * alchymyth,
 * Thank you very much, simply changing the get_sidebar to ‘about’ made the widgets
   on that page to immediately update. That must have been the issue.
 * I really appreciate the quick help!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Sidebar Code Help’ is closed to new replies.

## Tags

 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ty](https://wordpress.org/support/users/grvtyler/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/sidebar-code-help/#post-4637302)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
