doulao2128 2019-01-26 18:25
浏览 80
已采纳

Bootstrap轮播显示自定义分类而不是自定义帖子

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

  • 写回答

1条回答 默认 最新

  • drl57959 2019-01-26 19:35
    关注

    It looks like you're using the Advanced Custom Fields to hold the content that is stored in 'choose_testimonials'. Based on what I can see here, I would assume that settings inside of Advanced Custom Fields for that particular field are not correct.

    If this is not the case, the wrapper or WordPress template you're using are not correct. We would need some more information regarding these things to help!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?