October 20, 2014
<?php
global $post;
$current = get_the_terms($post->ID,'area');
$current = array_values($current); //print_r($current);
$args = array(
'post_type' => 'agents',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(array(
'taxonomy' => 'area',
'field' => 'slug',
'terms' => $current[0]->slug,
))
);
$current_area = get_posts($args);
foreach($current_area as $post) : setup_postdata($post); ?>
<li><?php the_post_thumbnail(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
</li>
<?php
endforeach; wp_reset_postdata();