• Editing comments.php — this is basically what I am trying to achieve:

    If this post is NOT in category id 3, then ….
    else ….

    I am struggling with the first part of the code. The following code isn’t working, not sure if I am close or far off… any suggestions?

    if (cat_ID != ‘3′) {

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
     $post = $wp_query->post;
     if ( is_category('3') ) {
     include(TEMPLATEPATH . '/xyz.php');
     } else {
     include(TEMPLATEPATH . '/abc.php');
     }
     ?>

    This is a conditiona tag that uses template xyz in cat 3 and template abc for everything else.

    This is the sort of thing you need to use

    Thread Starter meko

    (@meko)

    Thanks so much for the reply.

    After taking a break from it and looking again with fresh eyes, I decided the easiest approach was to use the following code

    <?php if ( in_category('3')) { ?>

    and switch the if then statements accordingly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to — if NOT in category then…’ is closed to new replies.