WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Code to find out if post belongs to X category

[Resolved] Code to find out if post belongs to X category

  • Hi, I want to change a variable if the post belong to ‘X’ category in single.php.

    I’m using:

    <?php
    $post = $wp_query->post;
    if ( in_category('X') ) {
    $blog_single_page_style == 3;
    } else {
    }
    ?>

    But it’s not working, any help would be appreciated, thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Code to find out if post belongs to X category’ is closed to new replies.
Skip to toolbar