Make WordPress Core

Changeset 1791


Ignore:
Timestamp:
10/13/2004 02:18:17 PM (21 years ago)
Author:
michelvaldrighi
Message:

unb0rked the pagination links

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-links.php

    r1785 r1791  
    505505    global $paged, $result, $request, $posts_per_page, $wpdb;
    506506    if (!$max_page) {
    507         preg_match('#WHERE (.*) GROUP BY#', $request, $matches);
    508         $where = $matches[1];
    509         $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where");
     507        preg_match('#FROM (.*) GROUP BY#', $request, $matches);
     508        $fromwhere = $matches[1];
     509        $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
    510510        $max_page = ceil($numposts / $posts_per_page);
    511511    }
     
    546546
    547547        if (get_query_var('what_to_show') == 'posts') {
    548             preg_match('#WHERE (.*) GROUP BY#', $request, $matches);
    549             $where = $matches[1];
    550             $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE $where");
     548            preg_match('#FROM (.*) GROUP BY#', $request, $matches);
     549            $fromwhere = $matches[1];
     550            $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
    551551            $max_page = ceil($numposts / $posts_per_page);
    552552        } else {
Note: See TracChangeset for help on using the changeset viewer.