• Hi, I have a custom post type with a taxonomy and several categories, with posts saved to each category. I want to create a page template that loops through the categories in turn, listing each post, like this:

    <h3>Custom Category One</h3>
    <ul>
    <li>Custom post 1</li>
    <li>Custom post 2</li>
    <li>Custom post 3</li>
    </ul>
    
    <h3>Custom Category Two</h3>
    <ul>
    <li>Custom post 4</li>
    <li>Custom post 5</li>
    <li>Custom post 6</li>
    </ul>

    I can use query_posts to fetch all the custom posts and spit them out in one long list, but how do I loop through the categories one by one? Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter plinth

    (@plinth)

    Discovered I can use this to loop through all the terms in a custom taxonomy, but it doesn’t go as far as listing the posts within each taxonomy.

    It’s close, but can any of you push it over the line?

Viewing 1 replies (of 1 total)

The topic ‘query_posts loop through taxonomy and posts separately’ is closed to new replies.