这并不难(我复制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的解决方案会更容易)。
这正是我一直在寻找的。非常感谢! – Justine 2009-09-03 13:29:21