Created
April 14, 2017 16:19
-
-
Save joshfeck/3e2327997531609e65bd51f01abf6e13 to your computer and use it in GitHub Desktop.
Custom loop for the Event Espresso people add-on that loops through each people type taxonomy term and displays the people that are set for that term
This file contains 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 | |
$post_type = 'espresso_people'; | |
$taxonomy = 'espresso_people_type'; | |
$terms = get_terms( array( | |
'taxonomy'=>$taxonomy, | |
'orderby'=>'name', | |
'order'=>'DESC', | |
)); | |
foreach( $terms as $term ) : | |
?> | |
<h2><?php echo $term->name; ?></h2> | |
<ul> | |
<?php | |
$posts = get_posts(array( | |
'post_type'=>$post_type, | |
'suppress_filters'=>false, | |
'tax_query'=>array( | |
array( | |
'taxonomy'=>$taxonomy, | |
'field'=>'slug', | |
'terms'=>$term | |
) | |
) | |
) | |
); | |
foreach( $posts as $post ) : | |
?> | |
<li> | |
<?php the_title();?> | |
</li> | |
<?php | |
endforeach; | |
?> </ul> <?php | |
endforeach; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment