Ticket #30170: export.patch
File export.patch, 2.4 KB (added by , 10 years ago) |
---|
-
export.php
116 116 * 117 117 * @since 3.1.0 118 118 * 119 * @param string $post_type The post type. Default 'post'. 119 * @param string $post_type The post type. Default 'post'. 120 * @param bool $oldest_month_selected Should the oldest month be selected? Default false. 120 121 */ 121 function export_date_options( $post_type = 'post' ) {122 function export_date_options( $post_type = 'post', $oldest_month_selected = false ) { 122 123 global $wpdb, $wp_locale; 123 124 124 125 $months = $wpdb->get_results( $wpdb->prepare( " … … 130 131 131 132 $month_count = count( $months ); 132 133 if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) 133 return;134 echo '<option value="0">' . __( 'No dates available' ) . '</option>'; 134 135 135 136 foreach ( $months as $date ) { 137 136 138 if ( 0 == $date->year ) 137 139 continue; 140 141 if ( true == $oldest_month_selected && $date == end( $months ) ) 142 $selected = 'selected="selected"'; 138 143 139 144 $month = zeroise( $date->month, 2 ); 140 echo '<option value="' . $date->year . '-' . $month . '" >' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';145 echo '<option value="' . $date->year . '-' . $month . '" ' . $selected . '>' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>'; 141 146 } 142 147 } 143 148 ?> … … 169 174 ?> 170 175 </li> 171 176 <li> 172 <label><?php _e( ' Date range:' ); ?></label>177 <label><?php _e( 'Include posts from:' ); ?></label> 173 178 <select name="post_start_date"> 174 <option value="0"><?php _e( 'Start Date' ); ?></option> 175 <?php export_date_options(); ?> 179 <?php export_date_options( 'post', true ); ?> 176 180 </select> 181 <label><?php _e( 'to:' ); ?></label> 177 182 <select name="post_end_date"> 178 <option value="0"><?php _e( 'End Date' ); ?></option>179 183 <?php export_date_options(); ?> 180 184 </select> 181 185 </li> … … 201 205 ?> 202 206 </li> 203 207 <li> 204 <label><?php _e( ' Date range:' ); ?></label>208 <label><?php _e( 'Include pages from:' ); ?></label> 205 209 <select name="page_start_date"> 206 <option value="0"><?php _e( 'Start Date' ); ?></option> 207 <?php export_date_options( 'page' ); ?> 210 <?php export_date_options( 'page', true ); ?> 208 211 </select> 212 <label> <?php _e( 'to:' ); ?></label> 209 213 <select name="page_end_date"> 210 <option value="0"><?php _e( 'End Date' ); ?></option>211 214 <?php export_date_options( 'page' ); ?> 212 215 </select> 213 216 </li>