我有一個自定義帖子類型,使用高級自定義字段來使用戶能夠輸入內容。我想獲得所有帖子,並連續顯示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
你能告訴我怎麼樣? –