Revision: 50363
Updated Code
at August 18, 2011 23:37 by wammerfors
Updated Code
<?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) { $args = array( '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 } ?>
Revision: 50362
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 18, 2011 23:35 by wammerfors
Initial Code
<?php // List posts by the terms for a custom taxonomy of any post type $post_type = 'kaffebrod'; $tax = 'typ-av-kaffebrod'; $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', '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 } ?>
Initial URL
Initial Description
Initial Title
List posts by the terms for a custom taxonomy of any post type
Initial Tags
wordpress
Initial Language
PHP