Support » Fixing WordPress » Code to find out if post belongs to X category

  • Resolved imagyx

    (@imagyx)


    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 ‘Code to find out if post belongs to X category’ is closed to new replies.