• Resolved socalgroove

    (@socalgroove)


    I am trying to set up different sidebars on Single.php based off of categories.

    I created a separate sidebar titled thinking-sidebar.php to be displayed for category 511. All categories that are not category 511, should be displayed using the default sidebar: sidebar.php.

    Below is the code that I tried. Problem is that sidebar.php shows up next to all posts and it does not display thinking-sidebar.php when a category 511 post is displayed.

    <?php if (is_category('511')) { get_sidebar('thinking-sidebar.php'); } else { get_sidebar('sidebar.php'); } ?>

    Thoughts? Suggestions? Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Different Sidebar by Category on Single.php Page’ is closed to new replies.