Support » Fixing WordPress » Multiple if is_category

  • Lee

    (@mylemonhead)


    Ive an existing code but is too long as ive many categories (>30). If i were to use the below code, it seems too much. Is there a better way to do it?

    <?php if ( is_category('1') || is_category('2') || is_category('3') ) {
        echo 'hi';
    }
    ?>

    Basically i want all child categories within the main category, not the posts under the child categories. Thanks for your time.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple if is_category’ is closed to new replies.