unb0rked the pagination links
git-svn-id: http://svn.automattic.com/wordpress/trunk@1791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
619c0d2f93
commit
a53659c2ab
|
@ -504,9 +504,9 @@ function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||||
function next_posts_link($label='Next Page »', $max_page=0) {
|
function next_posts_link($label='Next Page »', $max_page=0) {
|
||||||
global $paged, $result, $request, $posts_per_page, $wpdb;
|
global $paged, $result, $request, $posts_per_page, $wpdb;
|
||||||
if (!$max_page) {
|
if (!$max_page) {
|
||||||
preg_match('#WHERE (.*) GROUP BY#', $request, $matches);
|
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||||
$where = $matches[1];
|
$fromwhere = $matches[1];
|
||||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where");
|
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||||
$max_page = ceil($numposts / $posts_per_page);
|
$max_page = ceil($numposts / $posts_per_page);
|
||||||
}
|
}
|
||||||
if (!$paged)
|
if (!$paged)
|
||||||
|
@ -545,9 +545,9 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx
|
||||||
if (! is_single()) {
|
if (! is_single()) {
|
||||||
|
|
||||||
if (get_query_var('what_to_show') == 'posts') {
|
if (get_query_var('what_to_show') == 'posts') {
|
||||||
preg_match('#WHERE (.*) GROUP BY#', $request, $matches);
|
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||||
$where = $matches[1];
|
$fromwhere = $matches[1];
|
||||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where");
|
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||||
$max_page = ceil($numposts / $posts_per_page);
|
$max_page = ceil($numposts / $posts_per_page);
|
||||||
} else {
|
} else {
|
||||||
$max_page = 999999;
|
$max_page = 999999;
|
||||||
|
|
Loading…
Reference in New Issue