Support » Plugins » Changing content in sidebar depending on page

  • Hi.
    I’m currently porting my portfolio/blog to WordPress and I need to be able to change the content of my sidebar depending on which page I’m on. What’s to most easiet way to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Page Templates

    You can then replace the “get_sidebar” with an include to the sidebar you’d like to have, or no sidebar at all.

    So, what I should do is to delete the snippet that fetches the sidebar in the footer template file and instead fetch it from the index file (through a new page, so to speak)?

    Make a file for the particular sidebar you’re looking for for a page, saving it in your ./wp-content/themes/ThemeFolder directory.

    Then on the page’s template, yes, you’d replace the get_sidebar with <?php include('newsidebar.php') ?>.

    But what if I want to keep the orginal sidebar on my blog page (since I have a home, portfolio, about and blog page)?

    Thanks for your help GOBLUE14! 🙂

    Just run a conditional to see if it is the home page.

    Use that determine which file to call, OR, as I do on one of my sites, I have a home page template that is different than my other page template, so in that case my homepage template calls one header while my other pages call a different header. That can be done with sidebars just as easily.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing content in sidebar depending on page’ is closed to new replies.