2012-09-13 17 views
6

如何在WHILE循環中獲取當前帖子​​?Wordpress:在WHILE循環中獲取current_post索引號

$index_query = new WP_Query(array('post_type' => 'post', 'orderby' => 'modified', 'posts_per_page' => '-1', 'order' => 'DESC')); 
while ($index_query->have_posts()) : $index_query->the_post(); 

    // echo current post index number 

endwhile; 

已嘗試過以下但沒有結果。

$index_query->post->current_post; 

任何建議非常感謝!

回答