WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Sidebar: Is it possible to get <?php if (is_single() to act like (is_category()

[Resolved] Sidebar: Is it possible to get <?php if (is_single() to act like (is_category()

  • Heya,

    I’m working on a site where the side navigation changes depending what the category is. Easy to do with the (is_category('') tag. But I’d like the sidebar navigation to remain the same for all the single pages that are within that category. So lets say I have category ‘5’ for features which means for the is_category it looks something like

    <?php elseif (is_category('5') ) : ?>
    <div class="headline_line"><h2><span>Feature types</span></h2></div>
    <div class="content_features_navigation">
    	<div class="current"><li><a href="#">Print features</a></li></div>
    	<li><a href="#">Radio features</a></li>
    	<li><a href="#">Video features</a></li>
    	<li><a href="#">Photo features</a></li>
    	</div>

    I’d like to have the same thing for all the posts that are within this category. I know I could do this by making a single5.php file, and call a sidebar-features.php sidebar (or equivalent), but this seems like a bit of a labourious work-around. Is there a way to do it with a conditional tag in the sidebar. Sorry if this is really obvious, but I’ve scoured http://codex.wordpress.org/Conditional_Tags and couldn’t find anything.

    many thanks!
    edd

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Sidebar: Is it possible to get <?php if (is_single() to act like (is_category()’ is closed to new replies.