Hello,
I have two custom post types as People and Services with custom categories. I have created relationship for profiles that I have created on People post types with Services via ACF. So I can display the profiles in Services. For example,
In people post type, I have 5 profiles; Jack, Maria, Elizabeth, Henry and Nancy. These profiles categorized under service-category and people-county respectively.
In Service post type, I have multiple service offerings pages. So I can go to service offering page let’s say education, I can choose the profile in ACF custom field and display it in page via below query and the query works perfectly with carousel.
But What I really want is sorting them according to country.
Like;
US – Jake, Nancy
UK – Elizabeth
France – Maria, Henry
My code;
<div class=”people-items full-slider”>
<?php
$ids = get_field(‘people_exp’, false, false);
$query = new WP_Query(array(
‘post_type’ => ‘people’,
‘posts_per_page’ => 25,
‘post__in’ => $ids,
‘post_status’ => ‘any’,
‘orderby’ => ‘post__in’,
));
while ($query->have_posts()) : $query->the_post();
$info = get_post_meta(get_the_ID(), ‘_post_info’, true); if (!$info) $info = array();
?>
<div class=”item”>
<div class=”image”>
” style=”background-image: url(‘<?php echo get_the_post_thumbnail_url(get_the_ID(), ‘full’) ?>’)”>
</div>
<div class=”contact-info”>
<div class=”name”>“><?php echo $info[‘first’] ?> <?php echo $info[‘last’] ?></div>
<div class=”title”>
<span class=”job”><?php echo $info[‘title’] ?></span>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div>
I will be thankful if you could help me on this.