Advertisements

export_date_options

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

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: