From ee2181e92729e708a9f0f2ab4a1b166be3f79fd0 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Wed, 13 Oct 2004 14:18:17 +0000 Subject: [PATCH] unb0rked the pagination links git-svn-id: https://develop.svn.wordpress.org/trunk@1791 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-links.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index de7c99903f..2522bc0554 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -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) { global $paged, $result, $request, $posts_per_page, $wpdb; if (!$max_page) { - preg_match('#WHERE (.*) GROUP BY#', $request, $matches); - $where = $matches[1]; - $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where"); + preg_match('#FROM (.*) GROUP BY#', $request, $matches); + $fromwhere = $matches[1]; + $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere"); $max_page = ceil($numposts / $posts_per_page); } if (!$paged) @@ -545,9 +545,9 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx if (! is_single()) { if (get_query_var('what_to_show') == 'posts') { - preg_match('#WHERE (.*) GROUP BY#', $request, $matches); - $where = $matches[1]; - $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where"); + preg_match('#FROM (.*) GROUP BY#', $request, $matches); + $fromwhere = $matches[1]; + $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere"); $max_page = ceil($numposts / $posts_per_page); } else { $max_page = 999999;