我目前遇到一些麻烦只有2个职位显示在主页上。如何在主页上显示2个帖子?
这些从网站上其他地方的活动页面拉过来。
<div class="container">
<div class="row">
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; // End of the loop. ?>
<?php $whatson = new WP_Query(array(
'post_type' => 'whats_on'
)); ?>
<?php while($whatson->have_posts()) : $whatson->the_post(); ?>
<div class="col-sm-12 col-md-5">
<div class="thumbnail col-centered" style="width: 485px">
<?php the_post_thumbnail('thumbnail') ?>
<div class="caption">
<h3><?php the_title() ?></h3>
<h4><small></small></h4>
<p><?php the_field('whats_on_description'); ?></p>
</div><!--END caption-->
</div><!--END thumbnail-->
</div>
<?php endwhile; ?>
</div><!--END row-->
在此先感谢。我对这一切都很陌生。
通常的帖子数量已被管理员面板设置决定的,但你可以硬编码在'WP_Query'。 –