WordPress.org

Make WordPress Core

Changeset 34326


Ignore:
Timestamp:
09/19/2015 04:46:17 PM (5 years ago)
Author:
wonderboymusic
Message:

Export: allow Media to exported separately from other types.

Props PhilipLakin.
Fixes #32230.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/export.php

    r34249 r34326  
    3232            filters.slideUp('fast');
    3333            switch ( $(this).val() ) {
     34                case 'attachment': $('#attachment-filters').slideDown(); break;
    3435                case 'posts': $('#post-filters').slideDown(); break;
    3536                case 'pages': $('#page-filters').slideDown(); break;
     
    9091        if ( $_GET['page_status'] )
    9192            $args['status'] = $_GET['page_status'];
    92     } else {
     93    } elseif ( 'attachment' == $_GET['content'] ) {
     94        $args['content'] = 'attachment';
     95       
     96        if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
     97            $args['start_date'] = $_GET['attachment_start_date'];
     98            $args['end_date'] = $_GET['attachment_end_date'];
     99        }
     100    }
     101    else {
    93102        $args['content'] = $_GET['content'];
    94103    }
     
    226235<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
    227236<?php endforeach; ?>
    228 
     237<p><label><input type="radio" name="content" value="attachment" /> <?php _e( 'Media' ); ?></label></p>
     238<ul id="attachment-filters" class="export-filters">
     239    <li>
     240        <label><?php _e( 'Date range:' ); ?></label>
     241        <select name="attachment_start_date">
     242            <option value="0"><?php _e( 'Start Date' ); ?></option>
     243            <?php export_date_options( 'attachment' ); ?>
     244        </select>
     245        <select name="attachment_end_date">
     246            <option value="0"><?php _e( 'End Date' ); ?></option>
     247            <?php export_date_options( 'attachment' ); ?>
     248        </select>
     249    </li>
     250</ul>
    229251<?php
    230252/**
  • trunk/src/wp-admin/includes/export.php

    r33958 r34326  
    7676    }
    7777
    78     if ( 'post' == $args['content'] || 'page' == $args['content'] ) {
     78    if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
    7979        if ( $args['author'] )
    8080            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
Note: See TracChangeset for help on using the changeset viewer.