Support » Fixing WordPress » How to? Two Loops filtered by category

  • Resolved Adam Di Mario

    (@adam-di-mario)


    I’m trying to display two loops on my main page, one showing all post except the ones from a certain category, and the other one displaying only the posts from that category.

    Searching the Internet I found most people use query_posts to achieve that, but I read in the Codex that it would be better to use pre_get_post instead. In fact, the first 2 examples in the pre_get_post page of the codex sounded like what I was looking for, but they don’t work if you have 2 loops.

    So I searched for multiple loops, and again I found what I was looking for in the Codex, but, alas, those examples were using the dreaded query_posts.

    So my questions is: Can I safely use query_posts, or is there a better way?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to? Two Loops filtered by category’ is closed to new replies.