mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Make media button type default filter in Library browser. Props andy. fixes #6231
git-svn-id: http://svn.automattic.com/wordpress/trunk@7349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
848216b443
commit
575b8b4281
@ -966,8 +966,14 @@ $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_po
|
||||
foreach ( $matches as $_type => $reals )
|
||||
foreach ( $reals as $real )
|
||||
$num_posts[$_type] += $_num_posts[$real];
|
||||
$class = empty($_GET['post_mime_type']) ? ' class="current"' : '';
|
||||
$type_links[] = "<li><a href='" . remove_query_arg(array('post_mime_type', 'paged', 'm')) . "'$class>".__('All Types')."</a>";
|
||||
// If available type specified by media button clicked, filter by that type
|
||||
if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
|
||||
$_GET['post_mime_type'] = $type;
|
||||
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
|
||||
}
|
||||
if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
|
||||
$class = ' class="current"';
|
||||
$type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false)) . "'$class>".__('All Types')."</a>";
|
||||
foreach ( $post_mime_types as $mime_type => $label ) {
|
||||
$class = '';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user