/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?php
// List posts by the terms for a custom taxonomy of any post type
$post_type = 'posttypename';
$tax = 'taxonomyname';
$tax_terms = get_terms( $tax );
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
'post_type' => $post_type,
"$tax" => $tax_term->slug,
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) : ?>
<h2 class="produktgrupp"><?php /*?>All <?php echo $tax; ?> Posts For <?php */?><?php echo $tax_term->name; ?></h2>
<ul class="produktlistning">
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<span><?php the_post_thumbnail('produktlistning-thumbnail'); ?></span>
<h3><?php the_title(); ?></h3>
</a>
</li>
<?php endwhile; // end of loop ?>
</ul>
<?php else : ?>
<?php endif; // if have_posts()
wp_reset_query();
} // end foreach #tax_terms
}
?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                