我應該如何指望這個循環?WordPress的 - 在不同的循環計數
<?php
global $data;
$args = array('post_type' => 'post', 'posts_per_page' => $data['select_news']);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
有人可以幫我嗎?
非常感謝
完整代碼:
<?php
global $data;
$args = array('post_type' => 'post', 'posts_per_page' => $data['select_news']);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
<article class="article one-third column">
<div class="thumbnail">
<?php the_post_thumbnail('latest-news-thumb'); ?>
</div>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?><span>.</span></a></h2>
<div class="meta">
<span><?php _e('Postado em -', 'kula'); ?> <?php the_category(' & '); ?><br />on <strong><?php the_time('F jS, Y'); ?></strong></span>
<span><i class="icon-comment"></i> <a href="<?php the_permalink(); ?>#comments"><?php $commentscount = get_comments_number(); echo $commentscount; ?> <?php _e('Comentários', 'kula'); ?></a></span>
</div>
<?php the_excerpt(); ?>
<a class="read-more-btn" href="<?php the_permalink() ?>"><?php _e('Leia mais', 'kula'); ?> <span>→</span></a>
</article><!-- end article -->
<?php endwhile; ?>
我需要3個員額數3,把一類的文章...
所以我可以把文章類的代碼:
<?php if (($count%3)==0) {echo ' last';}?>
感謝
哪裏是計數,顯示完整的腳本。 –
我需要把這個循環計數,數不存在... –
[你可以使用像這樣的東西](http://stackoverflow.com/a/19090229/741747)。 –