Hiding a Categories content on just the Homepage ‘Posts’?

Is there a way I can hide a certain categories content from just the homepage Posts section of my WordPress Site? So, those posts are still posted and live; just not visible nor accessible from the homepage posts area. I’m calling the category twice on the homepage; once in the header within a plugin I’m using, and the other where the posts are created by default by WordPress. How can I hide my ‘featured’ category in the main page content of recent posts on the homepage?

Related posts

Leave a Reply

1 comment

  1. Okay, it sounds like you’ll want to modify the primary Loop using query_posts(), but only on the Site Front Page.

    I don’t think TwentyTen includes a front-page.php template file, so we’ll modify index.php directly. Add the following code to index.php, anywhere before the Loop output:

    <?php
    // Determine if we're on the site Front Page
    if ( is_front_page() ) {
        // Globalize $wp_query
        global $wp_query;
        // Create argument array in which we 
        // exclude desired category IDs. Categories
        // are listed as a comma-separated string.
        // e.g. '-3', or '-1,-2,-3'
        $exclude_cats = array( 'cat' => '-3' );
        // Merge custom arguments with default query args array
        $custom_query_args = array_merge( $wp_query->query, $exclude_cats );
        // Query posts using our modified argument array
        query_posts( $custom_query_args );
    } // is_front_page()
    ?>