about the archive(tag) page
-
there is a problem on archive page:
https://farm3.static.flickr.com/2446/3958798258_47f14c1b43.jpgor look at my site:
category page:https://www.gengtang.net/category/wordpresstag page:https://www.gengtang.net/tag/wordpress
as you see in the picture,the posts per page are 10,but only one tag page is showed(actual posts are 10 over)。 now i want the navigation of tag page to work like the navigation of category page as above in the picture,what shloud i do?
this is the code of controlling the navigation below:
function fvcity_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 4, $always_show = false) { global $request, $posts_per_page, $wpdb, $paged; if(empty($prelabel)) { $prelabel = '«'; } if(empty($nxtlabel)) { $nxtlabel = '»'; } $half_pages_to_show = round($pages_to_show/2); if (!is_single()) { if(!is_category()) { preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); } else { preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); } $fromwhere = $matches[1]; $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); $max_page = ceil($numposts /$posts_per_page); if(empty($paged)) { $paged = 1; } if($max_page > 0 || $always_show) { echo "$before <span class=\"fvpage\">页面 ($max_page):</span> <strong>"; if ($paged >= ($pages_to_show-1)) { echo '<a href="'.get_pagenum_link().'">« 首页</a> <span class="\fvpage\">...</span> '; } previous_posts_link($prelabel); for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { if ($i >= 1 && $i <= $max_page) { if($i == $paged) { echo "<span class=\"fvpage\">$i</span>"; } else { echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> '; } } } next_posts_link($nxtlabel, $max_page); if (($paged+$half_pages_to_show) < ($max_page)) { echo ' <span class="fvpage">...</span> <a href="'.get_pagenum_link($max_page).'">尾页 »</a>'; } echo "</strong>$after"; } } }
- The topic ‘about the archive(tag) page’ is closed to new replies.