我想显示为
<div class="team-list-wrapper clearfix wow fadeInUp" data-wow-duration="1s" data-wow-delay="0.5s">
<ul id="co-team">
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
</ul>
<ul id="co-team">
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
<li class="nav team-list">
<li>
</ul>
</div>
下面是我使用的代码:
<div class="team-list-wrapper clearfix wow fadeInUp" data-wow-duration="1s" data-wow-delay="0.5s">
<?php $args=array( \'post_type\'=>\'our-team\', \'post_status\' => \'publish\', \'posts_per_page\' => -1, \'caller_get_posts\'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { echo \'\'; $i = 0; while ($my_query->have_posts()) : $my_query->the_post(); if($i % 4 == 0) { ?>
<ul id="co-team">
<?php } ?>
<li class="nav team-list">
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id());?>" title="<?php echo get_the_title();?>" alt="<?php echo get_the_title();?>">
<div class="hover-item">
<div class="actv-desc">
<div class="team-details">
<div class="name">
<?php echo get_the_title();?><span><?php the_field(\'designation\'); ?></span>
</div>
<?php get_template_part( \'post\', \'content\'); ?>
</div>
</div>
</div>
</li>
<?php if($i % 4==0 ) { ?>
</ul>
<?php } $i++; endwhile; } wp_reset_query(); ?>
</div>
我的输出是:
<ul id="co-team">
<li class="nav team-list">
</ul>
<li class="nav team-list">
<li class="nav team-list">
<li class="nav team-list">
<ul id="co-team">
<li class="nav team-list">
</ul>
<li class="nav team-list">
<li class="nav team-list">
<li class="nav team-list">
<ul id="co-team">
<li class="nav team-list">
</ul>
<li class="nav team-list">
<li class="nav team-list">
<li class="nav team-list">
<ul id="co-team">
<li class="nav team-list">
</ul>
请帮忙。