Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




export_date_options [ WordPress Function ]

export_date_options ( $post_type = 'post' )
Defined at:



No description yet.

Source


<?php
function export_date_options$post_type 'post' ) {
    global 
$wpdb$wp_locale;

    
$months $wpdb->get_results$wpdb->prepare"
        SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
        FROM 
$wpdb->posts
        WHERE post_type = %s AND post_status != 'auto-draft'
        ORDER BY post_date DESC
    "
$post_type ) );

    
$month_count count$months );
    if ( !
$month_count || ( == $month_count && == $months[0]->month ) )
        return;

    foreach ( 
$months as $date ) {
        if ( 
== $date->year )
            continue;

        
$month zeroise$date->month);
        echo 
'<option value="' $date->year '-' $month '">' $wp_locale->get_month$month ) . ' ' $date->year '</option>';
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics