2
我在一個自定義帖子類型中添加了6個不同的帖子。就像團隊一樣,有6個不同的成員,我想在兩行中顯示這6個成員,每行3列。如何完成它?我是WordPress主題開發新手。嘗試編寫頭版,任何建議和資源將不勝感激。 我所做的就是這樣的,在wordpress主題中交替顯示自定義帖子類型
<section class="team" id="team">
<div class="container">
<div class="row">
<div class="team-heading text-center">
<h2>our team</h2>
<h4>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</h4></div>
<?php
$args = array(
'post_type' => 'team',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' =>3,
);
$the_query = new WP_Query($args);
?>
<?php if($the_query->have_posts()) : ?>
<?php while($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="col-md-2 single-member col-sm-4">
<div class="person">
<img class="img-responsive"> <?php the_post_thumbnail(); ?>
</div>
<div class="person-detail">
<div class="arrow-bottom"></div>
<h3><?php the_title(); ?></h3>
<p><?php the_content(); ?></p>
</div>
</div>
<!-- Query to display +1/next content-->
<div class="col-md-2 single-member col-sm-4">
<div class="person-detail">
<div class="arrow-top"></div>
<h3><?php the_title(); ?></h3>
<p><?php the_content(); ?> </p>
</div>
<div class="person">
<img class="img-responsive"> <?php the_post_thumbnail(); ?>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif ?>
對不起,如果我不能說清楚我的問題,我想完成的是,用第一個模板標籤 - >'the_title()'&'the_content()',我想要成員1st,並且第二個成員使用連續的'the_title()'&'the_content()'標籤。如果您對此問題提出任何其他最佳選擇,將會非常有效 – Milan
您想要偶數和奇數項目的交替標記?我會更新答案... – crean