Support » Themes and Templates » Exclude all posts from a specific category from being displayed on index.php?

  • I’d like to exclude all posts labeled under a specific category, say it’s called ‘personal’, from being displayed within the loop on the home page (ie index.php). Could someone point me to the tutorial or template tag page that shows me how to do that. Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Do a quick search – there are plenty of threads that tell how. (can’t remember off hand)

    I’m looking for the same thing, but the threads don’t seem to help that I’ve searched through. They’re all slightly different.

    I use the Front Page Cats plugin to do this.

    Folks I found it! The problem with the Codex is that it has hidden gems inside that we have to scroll down lots to find them. 😉 Once I found this one, I realised that so many more were hidden in the “examples”.

    The link is here:

    The Codex doesn’t have a Tips and Tricks section where it gathers all these handy examples. I wish it did. I hope the link was of some help to you guys.

    I am getting the following error when I use this codex:
    Parse error: parse error, unexpected T_ENDWHILE in /home2/acousti/public_html/wp/wp-content/themes/myzen/index.php on line 30

    This is what I have laid out:

    <?php get_header(); ?>

    <?php if (have_posts()) : ?>

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <!– The following tests if the current post is in category 3. –>
    <!– If it is not, the code within The Loop is executed as normal. –>
    <!– If it is, nothing is done until the next post is processed. –>
    <?php if ( !(in_category(’21’) && is_home()) ) { ?>

    <div class=”entries”>
    <span class=”title”>
    <?php the_title(); ?><br>

    <div class=”date”>
    <?php the_time(‘F’) ?><br><?php the_time(‘jS’) ?><br><?php the_time(‘Y’) ?>

    <?php the_content(‘Read the rest of this entry »’); ?>

    <div align=”center”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>Link | Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’,”,’|’); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>


    <?php endwhile; else: ?>
    Sorry, no posts matched your criteria.
    <?php endif; ?>

    <?php get_footer(); ?>

    Bump. Any clue what might be causing the error? I’ve messed with it unsuccessfully.

    Try the delete the first occurence of the following.
    <?php if (have_posts()) : ?>

    Try this plugin:
    Plugin Name: Category Visibility
    Plugin URI:

    It works perfectly with 1.5.3 and you dont have to muck up your source code. It has a few extras which are handy too.

    Alright, I got the exclude to work, finally, with some adjustments. But I’ve tried to modify it to do an include of the latest post of a specific category and am not having any luck. Anyone know how to do this? I’ve been able to display the last post as a permalink, but I want to display the last post (entire post) of a specific category.

    Nevermind, I just answered my own question. For those who may be looking for the same thing, try here:

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Exclude all posts from a specific category from being displayed on index.php?’ is closed to new replies.