/ Published in: PHP
                    
                                        
Wordpress 3.3 custom post type query that will get all of the taxonomies, loop through them, and output the posts from each.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
//for a given post type, return all
$post_type = 'energy-link';
$tax = 'category';
$tax_terms = get_terms($tax);
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
echo '
<div class="wrap_the_tax">
';
'post_type' => $post_type,
'taxonomy' => $tax,
'field' => 'slug',
'terms' => $tax_term->slug
)
),
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'operator' => 'IN'
); // END $args
$my_query = null;
$my_query = new WP_Query($args);
//debug($my_query);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
echo sces_smallblock( $post->post_title, $post->post_excerpt);
endwhile;
} // END if have_posts loop
wp_reset_query();
echo '
</div>
';
} // END foreach $tax_terms
} // END if $tax_terms
Comments
 Subscribe to comments
                    Subscribe to comments
                
                