Alternative loop, where tax = category and custom post type = "results"
$args = array( 'taxonomy' => 'category' );
$terms = get_terms( 'category', $args);
//START FOR EACH LOOP
foreach ($terms as $term) {
$post_type = 'results';
$tax = 'category';
$tax_terms = get_terms( $tax );
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
$args = array(
'post_type' => $post_type,
"$tax" => $tax_term->slug,
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) : ?>
// WHILE
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
// Do stuff
<?php endwhile; ?>
// END WHILE
<?php else : ?>
<?php endif; wp_reset_query(); ?>
}
// END FOR EACH LOOP