Different sidebar for posts in specific category

Community Forums Forums Design Tips and Tricks Different sidebar for posts in specific category

This topic is: not resolved

This topic contains 7 replies, has 5 voices, and was last updated by  jvandevorst 1 year, 9 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #24219

    Post count: 3

    I want to display a specific sidebar only for posts which are in a certain category. For example for posts that are “property listings” I want to display a certain sidebar. This is for the post page not the archive.

    I have tried this in functions.php but can’t get it to work:

    if (in_category(8)) {

    remove_action( ‘genesis_after_content’, ‘genesis_get_sidebar’ );
    add_action( ‘genesis_after_content’, ‘child_switch_sidebar’ );
    function child_switch_sidebar(){
    echo ‘<div id=”sidebar” class=”sidebar widget-area”>';
    echo ‘</div>';


    Post count: 9598

    Have you considered the Simple Sidebars plugin? It makes it easier to add sidebars on a post or page basis”

    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts


    Post count: 3

    Hi Susan,

    I should have mentioned that these posts are being created automatically by importing a feed. If I were creating them manually I agree that it Simple Sidebars would be a simple solution…no pun intended.  I need an automatic way for the post category to be recognized and then the right sidebar to be displayed.  BTW the sidebar was created using Simple Sidebars plugin.


    Post count: 7712

    Using Simple Sidebars…. if you go to Categories, and select a Category to edit – scroll down and you can allocate one of your simple sidebars to the category you created.


    Post count: 87

    well, the code got mangled and the above solution is easier, so I’ll let this post slide. :-)

    Brandon Kraft
    Blog | Twitter
    Genesis eNews Extended Support


    Post count: 3

    @anitac. Thanks for the suggestion.  Unfortunately that only changes the sidebar for the category/archive page but not the actual post page.

    Im trying to change the sidebar for the post Not the archive/category page.


    Post count: 10

    Does Simple Sidebars work with Dynamic Widgets?  DW is a pretty comprehensive free plugin that allows you to get really down to the nitty gritty of which widgets show up where.  It removes the need for multiple sidebars as it’s working on the individual widgets themselves.  Might be worth checking out


    Post count: 3

    @thewebprincess. I will check that out thanks.



Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.