我有一个自定义帖子类型,使用高级自定义字段来使用户能够输入内容。我想获得所有帖子,并连续显示3条帖子。让说:获取所有wordpress帖子并连续显示3个帖子
<div class="row">
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
</div>
<div class="row">
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
</div>
...
的问题是,它显示在<div class="row"></div>
都像这样的帖子:
<div class="row">
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
<div class="col-md-4">...</div>
...
</div>
下面是我的代码,我到目前为止已经试过:
<div class="row">
<?php
$args = array(
'post_type' => 'team',
'order' => 'ASC'
);
$the_query = new WP_Query($args);
while ($the_query->have_posts()) {
$the_query->the_post();
get_template_part('content', 'team');
}
?>
</div>
我的内容_team.php:
<div class="col-md-4">
<h3><?php the_field('name'); ?></h3>
<img src="<?php the_field('photo'); ?>" alt="<?php the_field('name'); ?>" />
<p class="smallTitle"><?php the_field('position'); ?></p>
<p><?php the_field('biography'); ?></p>
</div>
3使用MOD显示这个网站 – Khushboo
你能告诉我怎么样? –