Support » Fixing WordPress » different sidebars for individual pages

  • I have been wondering…I know it’s possible to change the sidebar to display different information by changing the PHP “get sidebar” code on any template file. Is it possible to do this for static Pages created in the WordPress admin area? I’d like to display some info about me on the sidebar on my Bio page, some info on my graphics and what I do to make them on my Graphics page, etc…

    I have made up another sidebar PHP file so that’s not an issue. The problem is when I call that sidebar into the Page Template EVERY page gets the sidebar and I want each Page to have a different sidebar. Is this possible and if so can how do I go about doing this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You could use conditional tags to display different sidebars.

    I’ve looked over the Conditional Tags. I might not be looking at the right thing…would I use any if/else functions? Exactly what tags should I be looking at and where do I use them?

    Yes, there should be if/else stuff (don’t ask me, I am a moron when it comes to write PHP code 🙂
    You should look at these tags (depending on your settings)
    When Page 42 is being displayed.
    is_page('About Me')
    When the Page with Title "About Me" is being displayed.
    When the Page with Page Slug "about-me" is being displayed.

    alrighty we are truly getting somewhere here…so if I add an if/else function for each page using the COnditional Tags i should get a different sidebar? I’m not too good with PHP myself lol

    Yes, that’s the idea. If is_page(x) – where x is the page_id # – include sidebar1.php, ifelse page(53) include sidebar.2php etc…
    There is an example in this thread
    with if statements… although it’s about different stylesheets for categories, the syntax is the same. I hope 🙂

    YES! That got it working! For now at least. I only applied the if to one page to test it but now I’ll try and make all the sidebars and apply them similarly. Thanks a bunch for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘different sidebars for individual pages’ is closed to new replies.