Wordpress 引导指示器不工作
$data=new WP_查询数组'post_type'=>myposttype','category'=>1,'posts_per_page'=>1; 如果$the\u query->have\u posts{Wordpress 引导指示器不工作,wordpress,Wordpress,$data=new WP_查询数组'post_type'=>myposttype','category'=>1,'posts_per_page'=>1; 如果$the\u query->have\u posts{ while ( $the_query->have_posts() ) { $data->the_post(); echo '<li data-target="#id" data-slide-to="8" class="new"></l
while ( $the_query->have_posts() ) {
$data->the_post();
echo '<li data-target="#id" data-slide-to="8" class="new"></li>';
}
wp_reset_postdata();
} ?>
上面的代码显示的转盘指示器等于没有帖子我希望它在4后显示一个指示器,请帮助我哪里错了
这不显示结果,请帮助
<ol class="carousel-indicators">
<?php $the_query = new WP_Query( array( 'post_type' => 'myposttype' ,'category' => 1 , 'posts_per_page' => -1,) );
if ( $the_query->have_posts() ) {
$j = 0;
while ( $the_query->have_posts() ) {
$j++;
$the_query->the_post();
} ?>
<li data-target="#myCarousel" data-slide-to=" <?php echo $j ?>" class=" <?php if($j==1) {echo 'active';} ?>"></li>';
<?php}
wp_reset_postdata();
} ?>
</ol>
试试这个