Title: Conditional Sidebars
Last modified: August 18, 2016

---

# Conditional Sidebars

 *  Resolved [marcusto](https://wordpress.org/support/users/marcusto/)
 * (@marcusto)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/conditional-sidebars/)
 * I am trying to include different sidebar combinations on a new project:
 * [http://www.whatsbetweenthesheets.com/index.php](http://www.whatsbetweenthesheets.com/index.php)
 * And for some reason on some pages (it seems random everytime I mess with the 
   source code) it will display a condition it shouldn’t. Each page should have 
   only two content boxes in the sidebar but some how some pages get two from another
   page.
 * The copy in the content box is coming from a Page Excerpt…Yes I know Pages don’t
   have excerpts but I found another post here that helped me add them…maybe that’s
   the issue.
 * Any help is very apprciated.
 * Here’s the sidebar code:
 * [**Moderated:** Removed that large amount of code. Please consider using a pastebin
   service such as [http://wordpress.pastebin.ca/](http://wordpress.pastebin.ca/)
   and posting a link back to the code]

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

 *  Thread Starter [marcusto](https://wordpress.org/support/users/marcusto/)
 * (@marcusto)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/conditional-sidebars/#post-519847)
 * OK,
 * Here is the new link to the code. I was unaware of the pastebin service.
 * [http://wordpress.pastebin.ca/345675](http://wordpress.pastebin.ca/345675)
 * Any help will be greatly appreciated.
 *  Thread Starter [marcusto](https://wordpress.org/support/users/marcusto/)
 * (@marcusto)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/conditional-sidebars/#post-519886)
 * OK, No Love here…got it.
 * I figured it out if someone else runs into this. All my template files call the
   default sidebar.
 * After the standard sidebar stuff I used if and elseif statements to call the 
   wp include template path tag and then created separate sidebar files with only
   the content I needed for each page.
 * Anywho…probably easy or obvious for most of you but for the rest of self-taught
   wordpress butcherers…i’ve got much love fo ya. STAY GEEK *Throws Fist in the 
   Air*
 *  [jabecker](https://wordpress.org/support/users/jabecker/)
 * (@jabecker)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/conditional-sidebars/#post-520043)
 * I changed the get sidebar function so that it accepts a parameter. I then feed
   it the name of the sidebar I want on a particular page. It defaults to the standard
   sidebar, so themes like the default that don’t pass in a parameter are still 
   OK. Works great. I’ve put that in the suggestion list so hopefully it will be
   added in the next release and I can stop hacking the function every time.

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

The topic ‘Conditional Sidebars’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [jabecker](https://wordpress.org/support/users/jabecker/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/conditional-sidebars/#post-520043)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
