WordPress.org

Ready to get started?Download WordPress

Forums

How can I exclude from the home page, posts from a category? (2 posts)

  1. wuops
    Member
    Posted 4 years ago #

    I want to show all the post in my home page, but I want to exclude the posts from the "x" category.

    What things I have to change to do that?

    Thanks.

  2. MichaelH
    Member
    Posted 4 years ago #

    To exclude category 95, using the WordPress Default theme for example, in the wp-content/themes/default/index.php file, just before the line:
    <?php if (have_posts()) : ?>

    put this:

    <?php query_posts($query_string . '&cat=-95'); ?>

    The query_posts() article explains the arguments in detail.

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

Topic Closed

This topic has been closed to new replies.

About this Topic