diff --git a/src/wp-admin/includes/screen.php b/src/wp-admin/includes/screen.php index 21f16305b4..5b8e2f7112 100644 --- a/src/wp-admin/includes/screen.php +++ b/src/wp-admin/includes/screen.php @@ -1022,7 +1022,7 @@ final class WP_Screen { id ] ) || $this->get_option( 'per_page' ) - || $this->get_option( 'media_grid_title' ) + || $this->get_option( 'misc_screen_options' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
@@ -1076,19 +1076,24 @@ final class WP_Screen { ?>
- get_option( 'media_grid_title' ) ): ?> -
+ get_option( 'misc_screen_options' ) ): + $misc_options = $this->get_option( 'misc_screen_options' ); + ?> +
_options as $column => $args ) { + if ( 'misc_screen_options' === $column ) { + continue; + } $id = "$column-hide"; echo '\n"; } ?>
diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js index fa76800a1d..80f910574c 100644 --- a/src/wp-admin/js/common.js +++ b/src/wp-admin/js/common.js @@ -27,11 +27,11 @@ columns = { }, saveManageColumnsState : function() { - var hidden, page; - if ( $( '#media_grid_title-hide' ).length ) { + var hidden, page, opts = $( '.misc-screen-options' ); + if ( opts.length ) { hidden = []; - $( '.hide-column-tog', '.media-grid-prefs' ).each( function() { - var $el, field = this.value.replace( 'media_grid_', '' ); + opts.find( '.hide-column-tog' ).each( function() { + var $el, field = this.value; $el = $( '.data-' + field ); if ( ! this.checked ) { hidden.push( field ); @@ -40,13 +40,13 @@ columns = { $el.removeClass( 'data-hidden' ).addClass( 'data-visible' ); } } ); - page = pagenow + 'grid'; + page = pagenow + opts.data( 'id' ); hidden = hidden.join( ',' ); } else { page = pagenow; hidden = this.hidden(); } - + $.post(ajaxurl, { action: 'hidden-columns', hidden: hidden, diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index 04a8688de4..b559309145 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -26,10 +26,11 @@ if ( 'grid' === $mode ) { wp_enqueue_script( 'media' ); wp_localize_script( 'media-grid', 'mediaGridSettings', array( 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) ) ); - add_screen_option( 'media_grid_title', array( 'label' => __( 'Name' ) ) ); - add_screen_option( 'media_grid_uploadedTo', array( 'label' => __( 'Uploaded To' ) ) ); - add_screen_option( 'media_grid_dateFormatted', array( 'label' => __( 'Date' ) ) ); - add_screen_option( 'media_grid_mime', array( 'label' => __( 'Mime-type' ) ) ); + add_screen_option( 'misc_screen_options', array( 'option' => 'manageuploadgridcolumnshidden', 'id' => 'grid' ) ); + add_screen_option( 'title', array( 'label' => __( 'Name' ) ) ); + add_screen_option( 'uploadedTo', array( 'label' => __( 'Uploaded To' ) ) ); + add_screen_option( 'dateFormatted', array( 'label' => __( 'Date' ) ) ); + add_screen_option( 'mime', array( 'label' => __( 'Mime-type' ) ) ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); include( ABSPATH . 'wp-admin/admin-footer.php' );