Last active
August 29, 2015 14:14
-
-
Save stephanieleary/cbb4dd88c2a71df4a90b to your computer and use it in GitHub Desktop.
Add filters for PDF, Word, and Excel files in the media library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Show MIMEs | |
Description: A tiny plugin to add more file type filters in the media library screens. | |
Author: Stephanie Leary | |
Version: 1.1 | |
Author URI: http://sillybean.net/ | |
*/ | |
function tvmdl_show_mime_types( $post_mime_types ) { | |
$new_mime_types = array( // array( adj, noun ) | |
'application/pdf' => array( __( 'PDFs' ), __( 'Manage PDFs' ), _n_noop( 'PDF <span class="count">(%s)</span>', 'PDFs <span class="count">(%s)</span>' ) ), | |
'application/msword' => array( __( 'Word Docs' ), __( 'Manage Word Docs' ), _n_noop( 'Word Doc <span class="count">(%s)</span>', 'Word Docs <span class="count">(%s)</span>' ) ), | |
'application/vnd.ms-excel' => array( __( 'Spreadsheets' ), __( 'Manage Spreadsheets' ), _n_noop( 'Spreadsheet <span class="count">(%s)</span>', 'Spreadsheets <span class="count">(%s)</span>' ) ), | |
); | |
return array_merge( $post_mime_types, $new_mime_types ); | |
} | |
add_filter( 'post_mime_types', 'tvmdl_show_mime_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment