posts_nav_link fixes from Denis-de-Bernardy. fixes #789
git-svn-id: http://svn.automattic.com/wordpress/trunk@2855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e62bcd9fd4
commit
35d02a7ab4
|
@ -437,9 +437,9 @@ function next_posts_link($label='Next Page »', $max_page=0) {
|
|||
if ( isset($max_num_pages) ) {
|
||||
$max_page = $max_num_pages;
|
||||
} else {
|
||||
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
|
||||
$fromwhere = $matches[1];
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
|
||||
$max_page = $max_num_pages = ceil($numposts / $posts_per_page);
|
||||
}
|
||||
}
|
||||
|
@ -479,9 +479,9 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx
|
|||
|
||||
if (get_query_var('what_to_show') == 'posts') {
|
||||
if ( ! isset($max_num_pages) ) {
|
||||
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
|
||||
$fromwhere = $matches[1];
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
|
||||
$max_num_pages = ceil($numposts / $posts_per_page);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue