WordPress.org

Ready to get started?Download WordPress

Forums

excluding a category from the loop (3 posts)

  1. threestyler
    Member
    Posted 6 years ago #

    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?

  2. moshu
    Member
    Posted 6 years ago #

    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.

  3. threestyler
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.