• These forums have been such a great help, I thought I might as well jump in and ask my own question. I’m using WP custom post type and taxonomies to create a custom theme to make WordPress act as the CMS for my personal site. I’ve been teaching myself PHP and the WordPress codex over the years so I want to make sure I get it right.

    I have a custom post type “Portfolio” with a hierarchical taxonomy “Project Type” registered to it. I want to list posts by their project type. Currently I’m running three seperate loops to display links for each project type (Web, Print, Illustration) Example one WP_Query is:

    <?php $thequery = new WP_Query('post_type=portfolio&posts_per_page=-1&project_type=web'); ?>
    --- Do some loop stuff ---

    end result looks something like this:

    <h2>Web</h2>
    <ul>
            <li><a>Project 1</a></li>....
    </ul>
    
    <h2>Print</h2>
    <ul>
            <li><a>Project 1</a></li>....
    </ul>
    ... etc

    Is it inefficient to have a loop per project type is there a way to have only one query for a custom post type and use conditionals in the loop to organize by project type? I’ve been searching the codex and forums and can’t seem to find a solution. Thanks in advance!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Most efficient way of looping through custom taxonomies’ is closed to new replies.