WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/22/2014 08:46:22 PM (5 years ago)
Author:
ocean90
Message:

Media Grid: Add a date filter.

props ericlewis.
fixes #28895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r29212 r29271  
    27732773        return;
    27742774
    2775     global $content_width, $wpdb;
     2775    global $content_width, $wpdb, $wp_locale;
    27762776
    27772777    $defaults = array(
     
    28262826        LIMIT 1
    28272827    " );
     2828    $months = $wpdb->get_results( $wpdb->prepare( "
     2829        SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
     2830        FROM $wpdb->posts
     2831        WHERE post_type = %s
     2832        ORDER BY post_date DESC
     2833    ", 'attachment' ) );
     2834    foreach ( $months as $month_year ) {
     2835        $month_year->text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month_year->month ), $month_year->year );
     2836    }
    28282837
    28292838    $settings = array(
     
    28472856        'embedMimes'   => $ext_mimes,
    28482857        'contentWidth' => $content_width,
     2858        'months'       => $months,
    28492859    );
    28502860
     
    29052915        'allMediaItems'          => __( 'All media items' ),
    29062916        'allMediaTypes'          => __( 'All media types' ),
     2917        'allDates'               => __( 'All dates' ),
    29072918        'noItemsFound'           => __( 'No items found.' ),
    29082919        'insertIntoPost'         => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
Note: See TracChangeset for help on using the changeset viewer.