• Hi

    I’m wondering if anyone can give me any advice, I’m trying to create a secondary blog within my blog (if that makes sense), the idea is that I could have news/events announcements and then comments on related interests on other sites with a link.

    I have created a new category for this and found a widget to display these posts as I do not wish them to appear within my regular posts which are reviews. My only sticking point is that I’m struggling to exclude this category from the query for my other posts, the code snippet at present is as follows:

    <?php query_posts( 'cat=ID&showposts=2' ); ?>
    and
    <?php query_posts('cat=ID&showposts=1&offset=2'); ?>
    and
    <?php query_posts('cat=-ID&showposts=8&offset=3'); ?>

    I’m using the Equilibrium theme, and I have tried doing the following:

    <?php query_posts( 'cat=-5&showposts=2' ); ?> (I think my new category has an ID of 5)

    I’ve also tried

    <?php query_posts( 'category__not_in=4&showposts=2' ); ?>

    and they don’t seem to be working. My website is https://www.jadedeye.com

    Thanks

    [Please post code between backticks or use the code button]

  • The topic ‘Excluding categories within query_posts’ is closed to new replies.