WordPress.org

Support

Support » How-To and Troubleshooting » How to show what category a post is in.

How to show what category a post is in.

  • easyrider
    Member

    @easyrider

    I would like to make a special sidebar that appears only when the reader is looking at a post from a specific category.

    I can’t figure out how to display the parent category id for a post.

    So I need to do do a if them statment to display they proper sidebar…

    If category 1 then display sidebar.php
    If category 2 then display sidebar2.php

    So how do I know what category a post is in and assign it to a variable?

  • The topic ‘How to show what category a post is in.’ is closed to new replies.