using in_category in sidebar
-
I would like to use in_category in the sidebar:
<?php $post = $wp_query->post; ?>
<?php if ( in_category('4') ) { ?>
<li class="box">
<h2>You're in Category 4!</h2>
<ul>
<?php echo "Sweet!!"; ?>
</ul>
</li>
<?php } ?>I have read:
https://codex.www.ads-software.com/Template_Tags/in_category#Use_OUTSIDE_The_Loop
but I can’t seem to get this working.Any advice? TIA!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘using in_category in sidebar’ is closed to new replies.