5 | | * Initialize the class by passing an array of arrays of parameters. Example: |
6 | | * |
7 | | * $date_query = new WP_Date_Query( array( |
8 | | * 'column' => 'optional, column to query against, default is post_date', |
9 | | * 'compare' => 'optional, see WP_Date_Query::get_compare()', |
10 | | * 'relation' => 'optional, OR or AND, how the sub-arrays should be compared, default is AND', |
11 | | * array( |
12 | | * 'column' => 'see above', |
13 | | * 'compare' => 'see above', |
14 | | * 'after' => 'string or array, see WP_Date_Query::build_mysql_datetime()', |
15 | | * 'before' => 'string or array, see WP_Date_Query::build_mysql_datetime()', |
16 | | * 'inclusive' => 'boolean, for after/before, whether exact value should be matched or not', |
17 | | * 'year' => '4 digit int', |
18 | | * 'month' => 'int, 1-12', |
19 | | * 'week' => 'int, 0-53', |
20 | | * 'day' => 'int, 1-31', |
21 | | * 'hour' => 'int, 0-23', |
22 | | * 'minute' => 'int, 0-60', |
23 | | * 'second' => 'int, 0-60', |
24 | | * ), |
25 | | * array( |
26 | | * ... |
27 | | * ), |
28 | | * ... |
29 | | * ) ); |
30 | | * |
31 | | * Then call the get_sql() method to get the MySQL WHERE string: |
32 | | * |
33 | | * $where .= $date_query->get_sql(); |
34 | | * |
| 5 | * Initialize the class by passing an array of arrays of parameters. |
| 6 | * |
79 | | * @param array $date_query A date query parameter array, see class descriptor for further details. |
80 | | * @param array (optional) $default_column What column name to query against. Defaults to "post_date". |
| 51 | * @param array $date_query { |
| 52 | * One or more associative arrays of date query parameters. |
| 53 | * |
| 54 | * @type array { |
| 55 | * @type string $column Optional. The column to query against. If undefined, inherits the value of |
| 56 | * the $default_column parameter. Default 'post_date'. Accepts 'post_date', |
| 57 | * 'post_date_gmt', 'post_modified','post_modified_gmt', 'comment_date', |
| 58 | * 'comment_date_gmt'. |
| 59 | * @type string $compare Optional. The comparison operator. |
| 60 | * Default '='. Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', |
| 61 | * 'BETWEEN', 'NOT BETWEEN'. |
| 62 | * @type string $relation Optional. The boolean relationship between the date queryies. |
| 63 | * Default 'OR'. Accepts 'OR', 'AND'. |
| 64 | * @type array { |
| 65 | * @type string|array $before Optional. Date to retrieve posts before. Accepts strtotime()-compatible |
| 66 | * string, or array of 'year', 'month', 'day' values. { |
| 67 | * |
| 68 | * @type string $year The four-digit year. Default empty. Accepts any four-digit year. |
| 69 | * @type string $month Optional when passing array.The month of the year. |
| 70 | * Default (string:empty)|(array:1). Accepts numbers 1-12. |
| 71 | * @type string $day Optional when passing array.The day of the month. |
| 72 | * Default (string:empty)|(array:1). Accepts numbers 1-31. |
| 73 | * } |
| 74 | * @type string|array $after Optional. Date to retrieve posts before. Accepts strtotime()-compatible |
| 75 | * string, or array of 'year', 'month', 'day' values. { |
| 76 | * |
| 77 | * @type string $year The four-digit year. Default empty. Accepts any four-digit year. |
| 78 | * @type string $month Optional when passing array.The month of the year. |
| 79 | * Default (string:empty)|(array:12). Accepts numbers 1-12. |
| 80 | * @type string $day Optional when passing array.The day of the month. |
| 81 | * Default (string:empty)|(array:last day of month). Accepts numbers 1-31. |
| 82 | * } |
| 83 | * @type string $column Optional. Used to add a clause comparing a column other than the column |
| 84 | * specified in the top-level $column paramater. Default is the value |
| 85 | * of top-level $column. Accepts 'post_date', 'post_date_gmt', |
| 86 | * 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt'. |
| 87 | * @type string $compare Optional. The comparison operator. Default '='. Accepts '=', '!=', |
| 88 | * '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. |
| 89 | * @type bool $inclusive Optional. Include results from dates specified in 'before' or 'after'. |
| 90 | * Default. Accepts. |
| 91 | * @type int $year Optional. The four-digit near number. Default empty. Accepts any |
| 92 | * four-digit year. |
| 93 | * @type int $month Optional. The two-digit month number. Default empty. Accepts numbers 1-12. |
| 94 | * @type int $week Optional. The week number of the year. Default empty. Accepts numbers 0-53. |
| 95 | * @type int $day Optional. The day of the month. Default empty. Accepts numbers 1-31. |
| 96 | * @type int $hour Optional. The hour of the day. Default empty. Accepts numbers 0-23. |
| 97 | * @type int $minute Optional. The minute of the hour. Default empty. Accepts numbers 0-60. |
| 98 | * @type int $second Optional. The second of the minute. Default empty. Accepts numbers 0-60. |
| 99 | * } |
| 100 | * } |
| 101 | * } |
| 102 | * @param array $default_column Optional. Default column to query against. Default 'post_date'. Accepts 'post_date', |
| 103 | * 'post_date_gmt', 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt'. |