Support » Fixing WordPress » excluding a category from the loop

  • I am using the following loop:

    <?php if (have_posts()) : ?>
    <?php query_posts(‘cat=-3’); ?>

    <?php while (have_posts()) : the_post(); ?>

    This excludes posts from the category ID 3, the problem is when I click next page it reloads the same content as the homepage.

    Why is this happening? and is there another workaround I could try?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Not really. Using query_posts generally break the next/prev navigation.
    There might be some workaround solution… if you are patient enough to search and search and search the forums.

    I think I posted this in the wrong forum, sorry.

    Thanks for a quick response.

    Im actually using multiple loops the first loops displays a post from the ‘featured’ category in a different position and layout to the rest of the posts, and the second loop is for the content minus the featured category otherwise the post appears twice on the main page.

    I’ll keep searching, and if anyone has any ideas suggestions I could try please let me know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘excluding a category from the loop’ is closed to new replies.