我创建了一个自定义帖子,用于在主页上显示图库并获取主页上的所有帖子需要在每个滑块中显示6个图像
请检查以下代码..
<div class="container-fluid">
<div class="row second-row">
<div
class="container">
<h2>gallery</h2>
<p>Lorem Ipsum is simply dummy
text of the printing and typesetting industry.
</p>
<nav>
<ul
class="control-box pager">
<li><a data-slide="prev"
href="#myCarousel" class=""><i class="glyphicon
glyphicon-chevron-left"></i></a></li>
<li><a data-slide="next"
href="#myCarousel" class=""><i class="glyphicon
glyphicon-chevron-right"></i></a></li>
</ul>
</nav>
</div>
<div
class="container">
<div class="row">
<div class="carousel slide
text-center" id="myCarousel">
<div class="carousel-inner">
<?php
$the_query = new WP_Query(array( 'post_type' => 'gallery',
'posts_per_page' => 6 )); while ( $the_query->have_posts() ) :
$the_query->the_post(); ?>
<div class="item active">
<ul
class="thumbnails">
<li class="col-sm-2">
<div class="fff">
<div
class="thumbnail"> <a href="#"><img alt="" src="<img src="<?php
the_post_thumbnail('large'); ?>"></a> </div>
<p><?php
the_title();?></p>
</div>
</li>
</ul>
</div>
<!-- /Slide1 --> <?php
endwhile; wp_reset_postdata(); ?> <?php $the_query = new
WP_Query(array( 'post_type' => 'gallery', 'posts_per_page' => 6,
'offset' => 1 )); while ( $the_query->have_posts() ) :
$the_query->the_post(); ?>
<div class="item">
<ul class="thumbnails">
<li class="col-sm-2">
<div class="fff">
<div class="thumbnail"> <a
href="#"> <img src="<img src="<?php the_post_thumbnail('large'); ?>
"></a> </div>
<p><?php the_title();?></p>
</div>
</li>
</ul>
</div>
<!-- /Slide2 --> <?php endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div>
</div>
</div>
</div>