Title: Problem adding sidebar to Underscores theme
Last modified: April 19, 2019

---

# Problem adding sidebar to Underscores theme

 *  [colmagoo](https://wordpress.org/support/users/colmagoo/)
 * (@colmagoo)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-adding-sidebar-to-underscores-theme/)
 * I have been struggling with this for hours now, any help appreciated. I am using
   Underscores theme with one sidebar (sidebar-1, on the left) and Custom Sidebars
   plugin so that I can have different side content on each page. The problem is
   when I add a new sidebar (sidebar-2) which I want to appear just above the footer
   to contain the same content on every page.
 * functions.php:
 *     ```
       function myunderscores3_widgets_init() {
           register_sidebar( array(
               'name'          => esc_html__( 'Sidebar', 'myunderscores3' ),
               'id'            => 'sidebar-1',
               'description'   => esc_html__( 'Add widgets here.', 'myunderscores3' ),
               'before_widget' => '<section id="%1$s" class="widget %2$s">',
               'after_widget'  => '</section>',
               'before_title'  => '<h2 class="widget-title">',
               'after_title'   => '</h2>',
               //'before_title' => '<!--', 
               //'after_title' => '-->',       
           ) );
           register_sidebar( array(
               'name'          => esc_html__( 'Bottom Sidebar', 'myunderscores3' ),
               'id'            => 'sidebar-2',
               'description'   => esc_html__( 'Add widgets here.', 'myunderscores3' ),
               'before_widget' => '<section id="%1$s" class="widget %2$s">',
               'after_widget'  => '</section>',
               'before_title'  => '<h2 class="widget-title">',
               'after_title'   => '</h2>',
               //'before_title' => '<!--', 
               //'after_title' => '-->',       
           ) );
       }
       add_action( 'widgets_init', 'myunderscores3_widgets_init' );
       ```
   
 * sidebar.php (for the sidebar-1 content):
 *     ```
       if ( ! is_active_sidebar( 'sidebar-1' ) ) {
           return;
       }
       ?>
   
       <aside id="secondary" class="widget-area">
           <?php dynamic_sidebar( 'sidebar-1' ); ?>
       </aside><!-- #secondary -->
       ```
   
 * page.php (to pull in sidebar-1):
 *     ```
       <?php
       get_sidebar();
       ?>
       </div><!-- wrapper -->    
       footer.php (to pull in sidebar-2):
   
       if (is_active_sidebar( 'sidebar-2' )) {
             dynamic_sidebar( 'sidebar-2' );
         }
       ?>
           </div><!-- #content -->
       ```
   
 * After adding widget content to sidebar-2 this is working fine on every page apart
   from the one page that has no sidebar-1 content. On this page the sidebar-2 content
   is appearing twice – on the bottom as expected and in sidebar-1 content area 
   also ! Furthermore the ‘no-sidebar’ class is missing from the body. In the backend
   the sidebar-1 widgets are located through each individual page whereas the sidebar-
   2 content is located through the widget (‘As Sidebar for selected Post Types’–
   Pages). On the actual page where the sidebar-2 content is appearing twice I have
   not specified any sidebars inside the actual page as I am doing this through 
   the widget settings. Any ideas ? Thank you
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproblem-adding-sidebar-to-underscores-theme%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [colmagoo](https://wordpress.org/support/users/colmagoo/)
 * (@colmagoo)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-adding-sidebar-to-underscores-theme/#post-11442396)
 * Sorry I have no idea how this question ended up in the ‘OceanWP’ area, I’m not
   finding the support areas particularly easy to navigate. Could a moderator please
   move this to the relevant area ?

Viewing 1 replies (of 1 total)

The topic ‘Problem adding sidebar to Underscores theme’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/oceanwp/4.1.6/screenshot.png)
 * OceanWP
 * [Support Threads](https://wordpress.org/support/theme/oceanwp/)
 * [Active Topics](https://wordpress.org/support/theme/oceanwp/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/oceanwp/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/oceanwp/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [colmagoo](https://wordpress.org/support/users/colmagoo/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/problem-adding-sidebar-to-underscores-theme/#post-11442396)
 * Status: not resolved