Title: Multiple sidebars loading same widgets
Last modified: August 19, 2016

---

# Multiple sidebars loading same widgets

 *  [shopefowler](https://wordpress.org/support/users/shopefowler/)
 * (@shopefowler)
 * [16 years ago](https://wordpress.org/support/topic/multiple-sidebars-loading-same-widgets/)
 * I have three sidebars on my site. Each appears on a specific page, per custom
   templates with `<?php include('sidebar2.php');` and `<?php include('sidebar3.
   php');`.
 * In the Admin there are three sidebars, each with a different set of widgets. 
   However on my site, each page displays the same set of widgets (the ones associated
   with the default sidebar.php
 * Here is the relevant code I’m using:
 * hometemplate.php
    `<?php include ('sidebar.php'); ?>`
 * blogtemplate.php
    `<?php get_sidebar('sidebar2.php') ?>`
 * memberstemplate.php
    `<?php get_sidebar('sidebar2.php') ?>`
 * functions.php
 *     ```
       if ( function_exists('register_sidebars') )
       register_sidebars(3);
       ```
   
 * sidebar.php, sidebar2.php and sidebar3.php hold identical code from the Kubrick
   theme.
 * Here are the affected pages:
    [http://smpsalabama.org](http://smpsalabama.org)
   [http://smpsalabama.org/blog/](http://smpsalabama.org/blog/) [http://smpsalabama.org/members/](http://smpsalabama.org/members/)

Viewing 1 replies (of 1 total)

 *  [prtscreen](https://wordpress.org/support/users/prtscreen/)
 * (@prtscreen)
 * [16 years ago](https://wordpress.org/support/topic/multiple-sidebars-loading-same-widgets/#post-1514012)
 * This is what you have to do:
    in your functions.php:
 *     ```
       if ( function_exists ('register_sidebar')) {
           register_sidebar ('2');
       }
       if ( function_exists ('register_sidebar')) {
           register_sidebar ('3');
       }
       ```
   
 * You have register each sidebar as it own sidebar.
    Replace this:
 *     ```
       if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) {
       				?>
       				<!-- Search form -->
       				<li><?php get_search_form(); ?></li>
   
       				<!-- Categories list -->
       				<?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>&hierarchical=0'); ?>
   
       				<!-- Tag cloud -->
       				<li>
       					<h2>Tags</h2>
       					<div><?php wp_tag_cloud('smallest=75&largest=175&unit=%'); ?></div>
       				</li>
   
       				<!-- Archives list -->
       				<li>
       					<h2>Archives</h2>
       					<ul>
       						<?php wp_get_archives('type=monthly'); ?>
       					</ul>
       				</li>
   
       				<!-- Bookmarks (links) list -->
       				<?php wp_list_bookmarks(); ?>
       				<!-- Meta links -->
       				<li>
       					<h2>Meta</h2>
       					<ul>
       						<?php wp_register(); ?>
       						<li><?php wp_loginout(); ?></li>
       						<?php wp_meta(); ?>
       					</ul>
       				</li>
       				<?php
       			}
       ```
   
 * whit this in your sidebar2/sidebar3.php-files:
 *     ```
       <?php if ( function_exists ( dynamic_sidebar(2) ) ) : ?>
       	<?php dynamic_sidebar (2); ?>
       <?php endif; ?>
       ```
   
 * Where you change ‘2’ to ‘3’ in you sidebar3.php
 * You include the sidebars with:
    `<?php get_sidebar(); ?>` <- For the default 
   sidebar(1) `<?php get_sidebar(2); ?>`<- Number 2 `<?php get_sidebar(3); ?>`<-
   Number 3
 * At least, thats how i do it!

Viewing 1 replies (of 1 total)

The topic ‘Multiple sidebars loading same widgets’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [prtscreen](https://wordpress.org/support/users/prtscreen/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/multiple-sidebars-loading-same-widgets/#post-1514012)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
