Support » Fixing WordPress » hiding categories on the front page

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, that seems a bit old. I think a better bethod is to exclude a category from the front page by introducing the exclusion directly inside the loop of the theme’s index.php

    Th loop starts something like this:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    To exclude category 4 from the front page, add this
    condition :

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

    This means that if on the front page, the post will be presented if it’s not in category 4. On pages other than the front ( home ) page, all posts are presented.

    Thanks, I will try that out. I knew that the my-hacks.php thing was old, but haven’t seen anything else which was comparable.

    chigh, did that work for you? I am looking to do the same thing.

    A full explanation of the method I tried to introduce can be found in The Loop, here.

    Thanks for all the info. I haven’t actually implemented this yet. I’ve been quite busy.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘hiding categories on the front page’ is closed to new replies.