For Each Term

$terms = get_terms('YOUR_REGISTERED_TAXONOMY');
foreach ($terms as $term) {
$tax_arryay = array (
'taxonomy'=>'YOUR_REGISTERED_TAXONOMY',
'term'=>$term->slug
);
$yourquery = new WP_Query ($tax_array);
$term_count = $yourquery->post_count;
echo $term->name;
if ($term_count > -1 ) {
while ($yourquery->have_posts()) : $yourquery->the_post();
the_title();
the_content();
echo get_post_meta(get_the_ID(),'meta_box_1', true);
echo get_post_meta(get_the_ID(),'meta_box_2', true);
echo get_post_meta(get_the_ID(),'meta_box_3', true);
endwhile;
} //end if term
} //end foreach term

Leave a Reply

Your email address will not be published. Required fields are marked *