include dates from all post types/stati. props michaelh, see #10317
git-svn-id: http://svn.automattic.com/wordpress/trunk@14506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
00ff1537d6
commit
684a20a176
|
@ -42,10 +42,12 @@ if ( isset( $_GET['download'] ) ) {
|
||||||
|
|
||||||
require_once ('admin-header.php');
|
require_once ('admin-header.php');
|
||||||
|
|
||||||
$dateoptions = '';
|
$dateoptions = array();
|
||||||
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 " ) ) {
|
$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'";
|
||||||
|
$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'";
|
||||||
|
if ( $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 ") ) {
|
||||||
foreach ( $monthyears as $monthyear ) {
|
foreach ( $monthyears as $monthyear ) {
|
||||||
$dateoptions .= "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n";
|
$dateoptions[] = "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,12 +69,12 @@ if ( $monthyears = $wpdb->get_results( "SELECT YEAR(post_date) AS `year`, MONTH(
|
||||||
<td><strong><?php _e('Start:'); ?></strong>
|
<td><strong><?php _e('Start:'); ?></strong>
|
||||||
<select name="mm_start" id="mm_start">
|
<select name="mm_start" id="mm_start">
|
||||||
<option value="all" selected="selected"><?php _e('All Dates'); ?></option>
|
<option value="all" selected="selected"><?php _e('All Dates'); ?></option>
|
||||||
<?php echo ($dateoptions); ?>
|
<?php echo implode( '', $dateoptions ); ?>
|
||||||
</select> <br/>
|
</select> <br/>
|
||||||
<strong><?php _e('End:'); ?></strong>
|
<strong><?php _e('End:'); ?></strong>
|
||||||
<select name="mm_end" id="mm_end">
|
<select name="mm_end" id="mm_end">
|
||||||
<option value="all" selected="selected"><?php _e('All Dates'); ?></option>
|
<option value="all" selected="selected"><?php _e('All Dates'); ?></option>
|
||||||
<?php echo $dateoptions; ?>
|
<?php echo implode( '', array_reverse( $dateoptions ) ); ?>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue