Make WordPress Core

Changeset 14506


Ignore:
Timestamp:
05/07/2010 08:51:01 PM (15 years ago)
Author:
wpmuguru
Message:

include dates from all post types/stati. props michaelh, see #10317

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r14444 r14506  
    4343require_once ('admin-header.php');
    4444
    45 $dateoptions = '';
    46 if ( $monthyears = $wpdb->get_results( "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC " ) ) {
     45$dateoptions = array();
     46$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'";
     47$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'";
     48if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) {
    4749    foreach ( $monthyears as $monthyear ) {
    48         $dateoptions .= "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n";
     50        $dateoptions[] = "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n";
    4951    }
    5052}
     
    6870<select name="mm_start" id="mm_start">
    6971    <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
    70 <?php echo ($dateoptions); ?>
     72<?php echo implode( '', $dateoptions ); ?>
    7173</select> <br/>
    7274<strong><?php _e('End:'); ?></strong>
    7375<select name="mm_end" id="mm_end">
    7476    <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
    75 <?php echo $dateoptions; ?>
     77<?php echo implode( '', array_reverse( $dateoptions ) ); ?>
    7678</select>
    7779</td>
Note: See TracChangeset for help on using the changeset viewer.