Created
October 11, 2013 11:00
-
-
Save Pushplaybang/6932956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php $custom_terms = get_terms('mytaxonomyname'); | |
| foreach($custom_terms as $custom_term) { | |
| wp_reset_query(); | |
| $args = array('post_type' => 'myposttypename', | |
| 'mytaxonomyname' => 'taxonomyitem', // might be unneccessary - test this | |
| 'tax_query' => array( | |
| array( | |
| 'taxonomy' => 'mytaxonomyname', | |
| 'field' => 'slug', | |
| 'terms' => $custom_term->slug, | |
| 'operator' => 'AND', | |
| ), | |
| ), | |
| ); | |
| $loop = new WP_Query($args); | |
| if($loop->have_posts()) { | |
| echo '<h2>'.$custom_term->name.'</h2>'; | |
| echo '<dl class="vertical tabs">'; | |
| while($loop->have_posts()) : $loop->the_post(); | |
| echo '<dd><a href="'.get_permalink().'" title="' . get_the_title() .'">'.get_the_title().'</a></dd>'; | |
| endwhile; | |
| echo '</dl>'; | |
| } | |
| } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment