您可以使用wp-pagenavi 并将“要显示的页数”设置为3,以便
[第一][6][7] [8] [上次]
现在,如果您只需要帖子的名称,那么您可以这样做:
global $wp_query;
//curent post
$thePostID = $wp_query->post->ID;
$my_query = new WP_Query(array(\'cat\' => get_query_var(\'cat\')));
$count = 0;
$curent_count = 0;
if ($my_query->have_posts()){
while ($my_query->have_posts()){
$no_repeat = array();
$my_query->the_post();
$count = $count + 1;
if ($count = 1 ){// the first post in the category
if (!in_array($post->ID,$no_repeat){
echo \'<a href="\'.the_permalink().\'">\'.the_title().\'</a> \';
$no_repeat[] = $post->ID;
}
}
if ($count = ($thePostID -1) ){//previous post
if (!in_array($post->ID,$no_repeat){
echo \'<a href="\'.the_permalink().\'">\'.the_title().\'</a> \';
$no_repeat[] = $post->ID;
}
}
if ($count = $thePostID){//Current post
if (!in_array($post->ID,$no_repeat){
echo \'<a href="\'.the_permalink().\'">\'.the_title().\'</a> \';
$no_repeat[] = $post->ID;
}
}
if ($count = ($thePostID + 1)){//Current post
if (!in_array($post->ID,$no_repeat){
echo \'<a href="\'.the_permalink().\'">\'.the_title().\'</a> \';
$no_repeat[] = $post->ID;
}
}
}
}
希望这有帮助。