Paging by days fix.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5c53295551
commit
d2c63d853a
|
@ -492,8 +492,8 @@ class WP_Query {
|
||||||
} elseif ($q['what_to_show'] == 'days') {
|
} elseif ($q['what_to_show'] == 'days') {
|
||||||
$startrow = $q['posts_per_page'] * (intval($page)-1);
|
$startrow = $q['posts_per_page'] * (intval($page)-1);
|
||||||
$start_date = $wpdb->get_var("SELECT max(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $startrow,1");
|
$start_date = $wpdb->get_var("SELECT max(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $startrow,1");
|
||||||
$endrow = $startrow + $q['posts_per_page'];
|
$endrow = $startrow + $q['posts_per_page'] - 1;
|
||||||
$end_date = $wpdb->get_var("SELECT min(post_date) FROM $wpdb->posts GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $endrow,1");
|
$end_date = $wpdb->get_var("SELECT min(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $endrow,1");
|
||||||
|
|
||||||
if ($page > 1) {
|
if ($page > 1) {
|
||||||
$where .= " AND post_date >= '$end_date' AND post_date <= '$start_date'";
|
$where .= " AND post_date >= '$end_date' AND post_date <= '$start_date'";
|
||||||
|
|
Loading…
Reference in New Issue