I currently have a loop for showing custom post type, from custom fields into a Bootstrap Carousel with indicators. The thing is, the custom post type has 2 categories(custom taxonomies company_testimonial and agent_testimonial) of which i want to show only one.
I am already lost
<?php
$post_objects_testimonials = get_field('choose_testimonials');
if ($post_objects_testimonials):
?>
<!-- Section testimonials -->
<section class="testimonials">
<div class="container">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php
$count = count($post_objects_testimonials);
for ($i = 0; $i < $count; $i++) {
?>
<li data-target="#carouselExampleIndicators" data-slide-to="<?php
echo $i;
--------
?>" <?php
if ($i == 0) {
?>
<div class="active">
<?php
}
?>
</li>
<?php
}
?>
</ol>
<div class="carousel-inner">
<?php
$count = 0;
?>
<?php
foreach ($post_objects_testimonials as $post):
?>
<?php
foreach ($post_objects_testimonials as $post):
?>
<?php
setup_postdata($post);
$test_image = get_field('test_image');
$test_image_url = $test_image['url'];
$test_image_alt = $test_image['alt'];
?>
<div class="carousel-item
<?php
if ($count == 0) {
echo ' active';
}
?>">
<div class="row">
<div class="col-lg-11 mx-auto">
<?php
if (get_field('description')):
?>
<p class="quote-paragraph">
<?php
the_field('description');
?>
</p>
<?php
endif;
?>
<?php
if (get_field('description') && get_field('job_title') && get_field('name')):
?>
<p class="quote-author">
<strong><?php
the_field('name');
?></strong>
<?php
the_field('job_title');
?>
<?php
the_field('company');
?>
</p>
<?php
endif;
?>
</div>
<?php
$count++;
?>
</div>
</div>
<?php
endforeach;
?>
</div>
<div class="arrow-icons">
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</section>
<?php
wp_reset_postdata();
?>
<?php
endforeach;
?>
<?php
endif;
?>
I expect to show taxonomy company_testimonial but ignore agent_testimonial