fixed posts_nav_link to use a much lighter query
git-svn-id: http://svn.automattic.com/wordpress/trunk@1783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
64e27492d1
commit
fc528e3d09
|
@ -546,18 +546,11 @@ function previous_posts_link($label='« Previous Page') {
|
|||
}
|
||||
|
||||
function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {
|
||||
global $request, $posts_per_page, $wpdb;
|
||||
global $posts_per_page, $wpdb;
|
||||
if (! is_single()) {
|
||||
$show_what = get_query_var('what_to_show');
|
||||
|
||||
if (get_query_var('what_to_show') == 'posts') {
|
||||
$nxt_request = $request;
|
||||
if ($pos = strpos(strtoupper($request), 'LIMIT')) {
|
||||
$nxt_request = substr($request, 0, $pos);
|
||||
}
|
||||
|
||||
$nxt_result = $wpdb->query($nxt_request);
|
||||
$numposts = $wpdb->num_rows;
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_date_gmt <= '".gmdate('Y-m-d H:i:s')."' AND post_status = 'publish'");
|
||||
$max_page = ceil($numposts / $posts_per_page);
|
||||
} else {
|
||||
$max_page = 999999;
|
||||
|
|
Loading…
Reference in New Issue