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, filterable via the 'date_query_valid_columns' filter. |
| 56 | * Default 'post_date'. Accepts 'post_date', 'post_date_gmt', 'post_modified', |
| 57 | * 'post_modified_gmt', 'comment_date', 'comment_date_gmt'. |
| 58 | * @type string 'compare' Optional. The comparison operator. |
| 59 | * Default '='. Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', |
| 60 | * 'BETWEEN', 'NOT BETWEEN'. |
| 61 | * @type string 'relation' Optional. The boolean relationship between the date queryies. |
| 62 | * Default 'OR'. Accepts 'OR', 'AND'. |
| 63 | * @type array { |
| 64 | * @type string|array 'before' { |
| 65 | * Optional. Date to retrieve posts before. |
| 66 | * Accepts strtotime()-compatible string, or array of 'year', 'month', 'day' values. |
| 67 | * |
| 68 | * @type string 'year' The four-digit year. |
| 69 | * Default empty. Accepts any four-digit year. |
| 70 | * @type string 'month' Optional when passing array.The month of the year. |
| 71 | * Default (string:empty)|(array:1). Accepts numbers 1-12. |
| 72 | * @type string 'day' Optional when passing array.The day of the month. |
| 73 | * Default (string:empty)|(array:1). Accepts numbers 1-31. |
| 74 | * } |
| 75 | * @type string|array 'after' { |
| 76 | * Optional. Date to retrieve posts after. |
| 77 | * Accepts strtotime()-compatible string, or array of 'year', 'month', 'day' values. |
| 78 | * |
| 79 | * @type string 'year' The four-digit year. |
| 80 | * Default empty. Accepts any four-digit year. |
| 81 | * @type string 'month' Optional when passing array.The month of the year. |
| 82 | * Default (string:empty)|(array:12). Accepts numbers 1-12. |
| 83 | * @type string 'day' Optional when passing array.The day of the month. |
| 84 | * Default (string:empty)|(array:last day of month). Accepts numbers 1-31. |
| 85 | * } |
| 86 | * @type string 'column' Optional. The column to query against. |
| 87 | * Default 'post_date'. Accepts 'post_date', 'post_date_gmt', 'post_modified', |
| 88 | * 'post_modified_gmt', 'comment_date', 'comment_date_gmt'. |
| 89 | * @type string 'compare' Optional. The comparison operator. |
| 90 | * Default '='. Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', |
| 91 | * 'BETWEEN', 'NOT BETWEEN'. |
| 92 | * @type bool 'inclusive' Optional. Include results from dates specified in 'before' or 'after'. |
| 93 | * Default. Accepts. |
| 94 | * @type int 'year' Optional. The four-digit near number. |
| 95 | * Default empty. Accepts any four-digit year. |
| 96 | * @type int 'month' Optional. The two-digit month number. |
| 97 | * Default empty. Accepts numbers 1-12. |
| 98 | * @type int 'week' Optional. The week number of the year. |
| 99 | * Default empty. Accepts numbers 0-53. |
| 100 | * @type int 'day' Optional. The day of the month. |
| 101 | * Default empty. Accepts numbers 1-31. |
| 102 | * @type int 'hour' Optional. The hour of the day. |
| 103 | * Default empty. Accepts numbers 0-23. |
| 104 | * @type int 'minute' Optional. The minute of the hour. |
| 105 | * Default empty. Accepts numbers 0-60. |
| 106 | * @type int 'second' Optional. The second of the minute. |
| 107 | * Default empty. Accepts numbers 0-60. |
| 108 | * } |
| 109 | * } |
| 110 | * } |
| 111 | * @param array $default_column Optional. What column name to query against. |
| 112 | * Defaults 'post_date'. Accepts 'post_date', 'post_date_gmt', 'post_modified', |
| 113 | * 'post_modified_gmt', 'comment_date', 'comment_date_gmt'. |