• Howdy,

    I’ve put in the code to hide a category from the front page but I’d like to hide more than one category. Can someone tell me the correct syntax to use?

    <?php if ( !(in_category('4')) || !is_home() ) { ?>
    <!-- Output the post here -->

    Thanks so much.

    Di

Viewing 3 replies - 1 through 3 (of 3 total)
  • This page in the codex may be useful: http://codex.wordpress.org/Function_Reference/in_category

    Try something like the following:

    <?php if ( !(in_category( (array('4','four','4th')) ) || !is_home() ) { ?>
    <!-- Output the post here -->

    Replacing the elements in the ‘array’ with your specific choices.

    Thread Starter belgrael

    (@belgrael)

    I tried the array code with the category numbers and it didn’t work but when I put the names of the categories in it worked just fine.
    Not sure why but it doesn’t matter because it works.

    Thanks so much!

    Di

    I believe you would simply use comma separated values when using numeric ID only, such as:

    <?php if ( !(in_category( '4,5,6' ) || !is_home() ) { ?>
    <!-- Output the post here -->

    Glad you found a working solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide Multiple Categories on Front Page’ is closed to new replies.