FriendlyWP
9/26/2013 - 12:21 PM

Snippet: WP: List Custom Post Type Group By Taxonomy

Snippet: WP: List Custom Post Type Group By Taxonomy

<?php		
$attractions = get_terms('attraction', array("fields" => "names"));		
for ( $myterm = 0; $myterm < count($attractions); $myterm++) { ?>
        <h3><?php echo $attractions[$myterm]; ?>:</h3>
        <div class="taxonomy_group">
        <?php $loop = new WP_Query(array('attraction' => $attractions[$myterm]));
            while ( $loop->have_posts() ) : $loop->the_post(); 
                get_template_part( 'content', 'things-to-do' );
            endwhile; ?>  
        </div>
<?php } ?>