Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Below we search for the Location name
- $custom_terms = get_terms('team-locations');
- foreach($custom_terms as $custom_term) {
- wp_reset_query();
- $args = array('post_type' => 'qp_team',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'team-locations',
- 'field' => 'slug',
- 'terms' => $custom_term->slug,
- ),
- ),
- );
- $loop = new WP_Query($args);
- if($loop->have_posts()) {
- echo '<h2>'.$custom_term->name.'</h2>';
- }
- }
- ?>
- <?php
- // Get the groups and show their related teachers
- $custom_terms_group= get_terms('team-group');
- foreach($custom_terms_group as $custom_term) {
- wp_reset_query();
- $args = array('post_type' => 'qp_team',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'team-group',
- 'field' => 'slug',
- 'terms' => $custom_term->slug,
- ),
- ),
- );
- $loop = new WP_Query($args);
- if($loop->have_posts()) {
- echo '<h2>'.$custom_term->name.'</h2>';
- while($loop->have_posts()) : $loop->the_post();
- echo '<a href="'.get_permalink().'">'.get_the_title().'</a><br>';
- endwhile;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment