这并不难(我复制了 cpharmston 的 PHP 代码):
<?php
// Create the Query
$query = new WP_Query('showposts=5');
if ($query->have_posts()) :
$i = 1; // for counting
// Create the Javascript slider thing
while ($query->have_posts()) : $query->the_post();
// Do stuff here
$i++; // make sure this is @ the end of the while-loop
endwhile;
$i = 1; // reset $i to 1 for counting
// Display the posts
while ($query->have_posts()) : $query->the_post();
// Do stuff here
$i++; // make sure this is @ the end of the while-loop
endwhile;
endif;
?>
您可以将 $i 用于#1、#2 等。每次 while 循环结束时,$i++ 都会确保它以 1 递增(因此在第一次之后 $i = 2 等)。
希望这会有所帮助:)(我确实认为 cpharmston 的解决方案会更容易)。