使用WP\\U查询的内置current_post
循环中的计数器:
while( have_posts() ):
the_post();
if( $wp_query->current_post == 0 ):
// this is the first post in the loop
else:
// this is > first post
endif;
endwhile;
使用html编辑:
<?php
while( have_posts() ):
the_post();
if( $wp_query->current_post == 0 ):
?>
featured post
category description
<ul>
<?php
else:
?>
<li>post</li>
<?php
endif;
endwhile;
?>
</ul>