Definition:
function export_date_options() {}
Source code
function export_date_options() {
global $wpdb, $wp_locale;
$months = $wpdb->get_results( "
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
FROM $wpdb->posts
WHERE post_type = 'post' AND post_status != 'auto-draft'
ORDER BY post_date DESC
" );
$month_count = count( $months );
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
return;
foreach ( $months as $date ) {
if ( 0 == $date->year )
continue;
$month = zeroise( $date->month, 2 );
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
}
}
9291

February 24, 2011 


No comments yet... Be the first to leave a reply!