Changeset 25139 for trunk/src/wp-includes/query.php
- Timestamp:
- 08/27/2013 04:38:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r25138 r25139 866 866 */ 867 867 var $meta_query = false; 868 869 /** 870 * Date query container 871 * 872 * @since 3.7.0 873 * @access public 874 * @var object WP_Date_Query 875 */ 876 var $date_query = false; 868 877 869 878 /** … … 2046 2055 $where .= " AND $wpdb->posts.menu_order = " . $q['menu_order']; 2047 2056 2048 // If a month is specified in the querystring, load that month2057 // The "m" parameter is meant for months but accepts datetimes of varying specificity 2049 2058 if ( $q['m'] ) { 2050 2059 $where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4); … … 2061 2070 } 2062 2071 2072 // Handle the other individual date parameters 2073 $date_parameters = array(); 2074 2063 2075 if ( '' !== $q['hour'] ) 2064 $ where .= " AND HOUR($wpdb->posts.post_date)='" . $q['hour'] . "'";2076 $date_parameters['hour'] = $q['hour']; 2065 2077 2066 2078 if ( '' !== $q['minute'] ) 2067 $ where .= " AND MINUTE($wpdb->posts.post_date)='" . $q['minute'] . "'";2079 $date_parameters['minute'] = $q['minute']; 2068 2080 2069 2081 if ( '' !== $q['second'] ) 2070 $ where .= " AND SECOND($wpdb->posts.post_date)='" . $q['second'] . "'";2082 $date_parameters['second'] = $q['second']; 2071 2083 2072 2084 if ( $q['year'] ) 2073 $ where .= " AND YEAR($wpdb->posts.post_date)='" . $q['year'] . "'";2085 $date_parameters['year'] = $q['year']; 2074 2086 2075 2087 if ( $q['monthnum'] ) 2076 $where .= " AND MONTH($wpdb->posts.post_date)='" . $q['monthnum'] . "'"; 2088 $date_parameters['monthnum'] = $q['monthnum']; 2089 2090 if ( $q['w'] ) 2091 $date_parameters['week'] = $q['w']; 2077 2092 2078 2093 if ( $q['day'] ) 2079 $where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'"; 2094 $date_parameters['day'] = $q['day']; 2095 2096 if ( $date_parameters ) { 2097 $date_query = new WP_Date_Query( array( $date_parameters ) ); 2098 $where .= $date_query->get_sql(); 2099 } 2100 unset( $date_parameters, $date_query ); 2101 2102 // Handle complex date queries 2103 if ( ! empty( $q['date_query'] ) ) { 2104 $this->date_query = new WP_Date_Query( $q['date_query'] ); 2105 $where .= $this->date_query->get_sql(); 2106 } 2107 2080 2108 2081 2109 // If we've got a post_type AND it's not "any" post_type. … … 2147 2175 } 2148 2176 2149 if ( $q['w'] )2150 $where .= ' AND ' . _wp_mysql_week( "`$wpdb->posts`.`post_date`" ) . " = '" . $q['w'] . "'";2151 2177 2152 2178 if ( intval($q['comments_popup']) )
Note: See TracChangeset
for help on using the changeset viewer.