WP_Date_Query.

props Viper007Bond.
see #18694.


git-svn-id: https://develop.svn.wordpress.org/trunk@25139 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-08-27 16:38:32 +00:00
parent 86f5f6ac78
commit c637de7316
7 changed files with 1466 additions and 9 deletions

View File

@@ -196,6 +196,15 @@ class WP_Comment_Query {
*/
var $meta_query = false;
/**
* Date query container
*
* @since 3.7.0
* @access public
* @var object WP_Date_Query
*/
var $date_query = false;
/**
* Execute the query
*
@@ -231,6 +240,7 @@ class WP_Comment_Query {
'meta_key' => '',
'meta_value' => '',
'meta_query' => '',
'date_query' => null, // See WP_Date_Query
);
$groupby = '';
@@ -360,6 +370,11 @@ class WP_Comment_Query {
$groupby = "{$wpdb->comments}.comment_ID";
}
if ( ! empty( $date_query ) && is_array( $date_query ) ) {
$date_query_object = new WP_Date_Query( $date_query, 'comment_date' );
$where .= $date_query_object->get_sql();
}
$pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits', 'groupby' );
$clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
foreach ( $pieces as $piece )