Locations
‘locations’,
‘posts_per_page’ => -1,
‘post_status’ => ‘publish’,
‘orderby’ => ‘title’,
‘order’ => ‘ASC’,
);
// Si hay filtro, lo aplicamos
if ( $selected_area ) {
$args[‘tax_query’] = array(
array(
‘taxonomy’ => ‘locations_areas’,
‘field’ => ‘slug’,
‘terms’ => $selected_area,
)
);
}
$query = new WP_Query($args);
if ( $query->have_posts() ) :
echo ‘
‘;
while ( $query->have_posts() ) : $query->the_post();
$direction = [];
if ( get_field( ‘locations_address’ ) ) :
$direction[] = get_field( ‘locations_address’ );
elseif ( get_field( ‘locations_address2’ ) ) :
$direction[] = get_field( ‘locations_address2’ );
endif;
if ( get_field( ‘locations_city’ ) ) :
$direction[] = get_field( ‘locations_city’ );
endif;
if ( get_field( ‘locations_state’ ) ) :
$direction[] = get_field( ‘locations_state’ );
endif;
if ( get_field( ‘locations_zip’ ) ) :
$direction[] = get_field( ‘locations_zip’ );
endif;
echo ‘‘;
endwhile;
echo ‘
‘;
endif;
?>