Some additional hooks for extensibility.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2006-12-01 10:15:15 +00:00
parent 7ed36f06aa
commit 51baba714f
1 changed files with 5 additions and 1 deletions

View File

@ -971,15 +971,19 @@ class WP_Query {
$orderby = apply_filters('posts_orderby', $q['orderby']); $orderby = apply_filters('posts_orderby', $q['orderby']);
$distinct = apply_filters('posts_distinct', $distinct); $distinct = apply_filters('posts_distinct', $distinct);
$fields = apply_filters('posts_fields', "$wpdb->posts.*"); $fields = apply_filters('posts_fields', "$wpdb->posts.*");
$limits = apply_filters( 'post_limits', $limits );
$found_rows = ''; $found_rows = '';
if ( !empty($limits) ) if ( !empty($limits) )
$found_rows = 'SQL_CALC_FOUND_ROWS'; $found_rows = 'SQL_CALC_FOUND_ROWS';
$request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby ORDER BY $orderby $limits"; $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby ORDER BY $orderby $limits";
$this->request = apply_filters('posts_request', $request); $this->request = apply_filters('posts_request', $request);
$this->posts = $wpdb->get_results($this->request); $this->posts = $wpdb->get_results($this->request);
if ( !empty($limits) ) { if ( !empty($limits) ) {
$this->found_posts = $wpdb->get_var('SELECT FOUND_ROWS()'); $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' );
$this->found_posts = $wpdb->get_var( $found_posts_query );
$this->found_posts = apply_filters( 'found_posts', $this->found_posts );
$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
} }
// Check post status to determine if post should be displayed. // Check post status to determine if post should be displayed.