Title: Problems with widgets in multiple sidebars
Last modified: August 20, 2016

---

# Problems with widgets in multiple sidebars

 *  Resolved [Odenberg](https://wordpress.org/support/users/murmelin/)
 * (@murmelin)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/)
 * I have two sidebar. One “sidebar1.php” is called in the index.php with
    <?php
   include (TEMPLATEPATH . ‘/sidebar1.php’); ?>
 * The second side bar is called in the page.php with
    <?php include (TEMPLATEPATH.‘/
   sidebar2.php’); ?>
 * I also have this in the fuctions.php:
    ( function_exists(‘register_sidebars’))
   register_sidebars(2);
 * So far so good. In Appearence/Widgets the to sidebars show up and I put the Category
   widget to sidebar1 and Show Pages widget in sidebar2.
 * But still, when I look at a Page, it is Categories that shows up in the sidebar,
   not the Page as I want.
 * It is my own built theme and I have never had this problem with the sidebars 
   before.
    Please help me.

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

 *  Thread Starter [Odenberg](https://wordpress.org/support/users/murmelin/)
 * (@murmelin)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473638)
 * Anyone? Please, I really nedd some help…
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473642)
 * [This may help](http://codex.wordpress.org/Function_Reference/register_sidebars),
   prob have to add some args to make them unique.
 *  Thread Starter [Odenberg](https://wordpress.org/support/users/murmelin/)
 * (@murmelin)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473654)
 * Thanks a lot! Now it works!
 * I replaced the code in my first post with:
    index.php <?php if ( !function_exists(‘
   dynamic_sidebar’) || !dynamic_sidebar(‘sidebar1’) ) : ?> <?php endif; ?>
 * page.php
    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘
   sidebar2’) ) : ?> <?php endif; ?>
 * functions.php
    ( function_exists(‘register_sidebar’) ) register_sidebar(array(‘
   name’=>’sidebar1’,)); register_sidebar(array(‘name’=>’sidebar2’,));
 * BUT, since my sidebar1.php and sidebar2.php is no longer in use, all my styling
   disappeared. And now I dont have any div ids/classes to style in my css. So how
   can I apply my old styling to the sidebars?
 *  Thread Starter [Odenberg](https://wordpress.org/support/users/murmelin/)
 * (@murmelin)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473662)
 * Okey. I missunderstood how to do it, and here is the very solution:
 * STEP 1: functions.php
    Register the sidebars in the function.php like this: (
   function_exists(‘register_sidebar’) ) register_sidebar(array(‘name’=>’sidebar1’,));
   register_sidebar(array(‘name’=>’sidebar2’,)); register_sidebar(array(‘name’=>’
   sidebar3’,));
 * STEP 2: index.php / page.php / category.php
    Call the sidebar.php (or sidebar2.
   php if you have more than one sidebar template) <?php include(“sidebar.php”);?
   >
 * STEP 3: sidebar.php
    Create a div and add the widgetized sidebar you want to 
   call with: <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘
   sidebar1’) ) : ?> <?php endif; ?>
 * STEP 4: css file
    Style the div where you put the ‘dynamic_sidebar’
 * Swanson, THANKS A LOT for pointing me in the right direction.
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473668)
 * create functions ‘index_sidebar_style’ and ‘page_sidebar_style’, which are just
   CSS.
 * Call each as required (CSS should not be in the body – accomplish with if index
   if page?):
 *     ```
       <?php include('index_sidebar_style') ?>
       <?php include('page_sidebar_style') ?>
       ```
   
 * Example:
 *     ```
       <?php function page_sidebar_style() {  ?>
       <style type="text/css">
       table {
       border: 1px dashed black;
       background: #95EAFE;
       text-align:left;
       width:610px;
       }
       </style>
       <?php }  ?>
       ```
   
 * Might need some tweaking but the basic concept is shown above.

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

The topic ‘Problems with widgets in multiple sidebars’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/problems-with-widgets-in-multiple-sidebars/#post-2473668)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
