我试图使用引导旋转木马在我的页面中显示一些自定义帖子,如下图所示
但现在,我的旋转木马只显示了两次相同的帖子,如下图所示
这是我的密码:
<?php $args = array(\'post_type\' => \'cases\', \'order\' => \'DESC\', \'orderby\' => \'date\', \'posts_per_page\' => \'-1\');
$the_query = new WP_Query( $args );
if( $the_query->have_posts() ):?>
<?php $index = 0; ?>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<article class="container">
<div class="row">
<div class="carousel-inner">
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="item<?php if ($index == 1) { echo \' active\'; } ?>">
<div class="col-md-6">
<?php
$imagem_personalizada = get_field(\'capa_da_pagina_do_case\');
$thumb_capa = wp_get_attachment_image_src($imagem_personalizada, \'capaIdeia\');
?>
<a href="<?php the_permalink(); ?>" style="text-decoration: none;">
<br>
<div id="secao-titulo-ideia-single" class="nopadding">
<img class="img-responsive center-block" src="<?php echo $thumb_capa[0]; ?>" alt="Thumb Post" width="100%">
<h2 class="brandonregular titulo-ideia-single text-center"> <?php the_field(\'titulo_do_case\'); ?> </h2>
</div>
</a>
</div>
<div class="col-md-6">
<a href="<?php the_permalink(); ?>" style="text-decoration: none;">
<div class="nopadding">
<img class="img-responsive center-block" src="<?php echo $thumb_capa[0]; ?>" alt="Thumb Post" width="100%">
<h2 class="brandonregular"> <?php the_field(\'titulo_do_case\'); ?> </h2>
</div>
</a>
</div>
</div>
<?php $index++; ?>
<?php endwhile; ?>
</div>
</div>
</article>
</div>
<?php endif; ?>
<?php wp_reset_query(); wp_reset_postdata(); ?>
我不知道为什么会这样,我尝试了很多不同的方法,但我找不到解决这个问题的方法。
我做错了什么?