Changeset 4112 for trunk/wp-includes/link-template.php
- Timestamp:
- 08/24/2006 10:33:16 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/link-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r3862 r4112 477 477 478 478 if (isset($max_num_pages)) return $max_num_pages; 479 479 $posts_per = (int) get_option('posts_per_page'); 480 if ( empty($posts_per) ) $posts_per = 1; 481 480 482 if ( 'posts' == get_query_var('what_to_show') ) { 481 483 preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); 482 484 $fromwhere = $matches[1]; 483 485 $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); 484 $max_num_pages = ceil($numposts / get_option('posts_per_page'));486 $max_num_pages = ceil($numposts / $posts_per); 485 487 } else { 486 488 preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); 487 489 $fromwhere = preg_replace('/( AND )?post_date >= (\'|\")(.*?)(\'|\")( AND post_date <= (\'\")(.*?)(\'\"))?/siU', '', $matches[1]); 488 490 $num_days = $wpdb->query("SELECT DISTINCT post_date FROM $fromwhere GROUP BY year(post_date), month(post_date), dayofmonth(post_date)"); 489 $max_num_pages = ceil($num_days / get_option('posts_per_page'));491 $max_num_pages = ceil($num_days / $posts_per); 490 492 } 491 493
Note: See TracChangeset
for help on using the changeset viewer.