Exclude Category from query_posts loop (2 posts)

  1. bradstinyworld
    Posted 7 years ago #

    Since I have no idea what is going on with the other post getting closed even before it was posted let's try again. I need to exclude a category from this loop. I have searched through the archives and tried several things, but couldn't find one that worked right. For the record I want to exclude category 17. The loop in question is the chronological posts in the lower left column at http://bradstinyworld.com

    ' <div class="hometitle">Latest Posts</div>

    <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=3&paged=$page"); while ( have_posts() ) : the_post() ?>

    <h3>" rel="bookmark"><?php the_title(); ?></h3>

    <?php the_content_limit(175, "[Read more]"); ?>

    <?php endwhile; ?>'

  2. MichaelH
    Posted 7 years ago #

    Look at the cat=-17 (notice the minus sign) or the category__not_in examples in the Codex article:

    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Note: I don't see the CLOSED thread you mentioned, but I see a duplicate thread at http://wordpress.org/support/topic/237355

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.