0
私は私のワードプレステーマに入れた基本的なブートストラップカルーセルを持っています。カルーセルに最新の3つの投稿を表示したい。私は "posts_per_page => 3"を使ってこれをやろうとしましたが、もしそうすれば、私のCSSは混乱してしまい、divsを混乱させてしまいます。そのため、私は "posts_per_pageは> 1 =" ここに私のコードです使用しています:ワードプレスのカルーセルは他の投稿を表示していません
<!-- Home Carousel -->
<div id="home-carousel" class="carousel carousel-home slide" data-ride="carousel" data-interval="5000">
<!-- Wrapper for slides -->
<div class="carousel-inner" style="margin-top:0px; background-color:transparent; height:30em;">
<div class="active item">
<?php the_post_thumbnail('large');?>
<div class="carousel-caption">
<a href="<?php the_permalink(); ?>"> <h1><?php the_title();?></h1></a>
<?php
$the_query = new WP_Query(array(
'category_name' => 'Featured',
'posts_per_page' => 1
));
while ($the_query->have_posts()) :
$the_query->the_post();
?>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<div class="item">
<?php the_post_thumbnail('large');?>
<div class="carousel-caption">
<a href ="<?php the_permalink(); ?>"><h1><?php the_title();?></h1></a>
</div>
<?php
wp_reset_postdata();
?>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#home-carousel" data-slide="prev">
<span>
<i class="fa fa-chevron-left"></i>
</span>
</a>
<a class="right carousel-control" href="#home-carousel" data-slide="next">
<span>
<i class="fa fa-chevron-right"></i>
</span>
</a>
<!-- END Controls -->
</div>