WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] using in_category in sidebar (2 posts)

  1. solutionsphp
    Member
    Posted 8 years ago #

    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:
    http://codex.wordpress.org/Template_Tags/in_category#Use_OUTSIDE_The_Loop
    but I can't seem to get this working.

    Any advice? TIA!

  2. solutionsphp
    Member
    Posted 8 years ago #

    Doh! It wasn't working because I had a post assigned to the wrong cat!!

Topic Closed

This topic has been closed to new replies.

About this Topic