Show correct export date range for pages. The query should use provided $post_type instead of always 'post'. Props sorich87. Fixes #19312.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b20fbf6fd1
commit
29d5e3c83c
|
@ -95,15 +95,15 @@ if ( isset( $_GET['download'] ) ) {
|
||||||
|
|
||||||
require_once ('admin-header.php');
|
require_once ('admin-header.php');
|
||||||
|
|
||||||
function export_date_options() {
|
function export_date_options( $post_type = 'post' ) {
|
||||||
global $wpdb, $wp_locale;
|
global $wpdb, $wp_locale;
|
||||||
|
|
||||||
$months = $wpdb->get_results( "
|
$months = $wpdb->get_results( $wpdb->prepare( "
|
||||||
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
|
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
|
||||||
FROM $wpdb->posts
|
FROM $wpdb->posts
|
||||||
WHERE post_type = 'post' AND post_status != 'auto-draft'
|
WHERE post_type = %s AND post_status != 'auto-draft'
|
||||||
ORDER BY post_date DESC
|
ORDER BY post_date DESC
|
||||||
" );
|
", $post_type ) );
|
||||||
|
|
||||||
$month_count = count( $months );
|
$month_count = count( $months );
|
||||||
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
||||||
|
@ -182,11 +182,11 @@ function export_date_options() {
|
||||||
<label><?php _e( 'Date range:' ); ?></label>
|
<label><?php _e( 'Date range:' ); ?></label>
|
||||||
<select name="page_start_date">
|
<select name="page_start_date">
|
||||||
<option value="0"><?php _e( 'Start Date' ); ?></option>
|
<option value="0"><?php _e( 'Start Date' ); ?></option>
|
||||||
<?php export_date_options(); ?>
|
<?php export_date_options( 'page' ); ?>
|
||||||
</select>
|
</select>
|
||||||
<select name="page_end_date">
|
<select name="page_end_date">
|
||||||
<option value="0"><?php _e( 'End Date' ); ?></option>
|
<option value="0"><?php _e( 'End Date' ); ?></option>
|
||||||
<?php export_date_options(); ?>
|
<?php export_date_options( 'page' ); ?>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Reference in New Issue