Changeset 3694
- Timestamp:
- 04/05/2006 08:48:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-links.php
r3678 r3694 474 474 $fromwhere = $matches[1]; 475 475 $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); 476 returnceil($numposts / get_option('posts_per_page'));476 $max_num_pages = ceil($numposts / get_option('posts_per_page')); 477 477 } else { 478 478 $posts = $wp_query->posts; 479 preg_match('#WHERE\s(.*)\sORDER BY#siU', $wp_query->request, $matches); 480 $where = preg_replace('/( AND )?post_date >= (\'|\")(.*?)(\'|\")( AND post_date <= (\'\")(.*?)(\'\"))?/siU', '', $matches[1]); 481 $num_days = $wpdb->query("SELECT DISTINCT post_date FROM $wpdb->posts WHERE $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date)"); 482 return ceil($num_days / get_option('posts_per_page')); 483 } 479 preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); 480 $fromwhere = preg_replace('/( AND )?post_date >= (\'|\")(.*?)(\'|\")( AND post_date <= (\'\")(.*?)(\'\"))?/siU', '', $matches[1]); 481 $num_days = $wpdb->query("SELECT DISTINCT post_date FROM $fromwhere GROUP BY year(post_date), month(post_date), dayofmonth(post_date)"); 482 $max_num_pages = ceil($num_days / get_option('posts_per_page')); 483 } 484 485 return $max_num_pages; 484 486 } 485 487
Note: See TracChangeset
for help on using the changeset viewer.