Skip to content

Instantly share code, notes, and snippets.

@rezzz-dev
rezzz-dev / gist:6713387
Created September 26, 2013 12:21
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>