public
Last active

Allow non-image mime-types in the multiple featured image plugin

  • Download Gist
MFI_more_mime_types.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// In function kd_meta_box_output() replace
 
$thumbnail = wp_get_attachment_image( $image_id, array( 266, 266 ) );
 
//With...
$type = get_post_mime_type($iamge_id);
$icon = in_array($type, array('application/pdf')) ? true : false;
$thumbnail = wp_get_attachment_image( $image_id, array( 266, 266 ), $icon );
 
 
// And in function kd_ajax_set_image(), replace
$thumb_html = wp_get_attachment_image( $thumb_id, 'thumbnail', $icon);
 
//With...
$type = get_post_mime_type($thumb_id);
$icon = in_array($type, array('application/pdf'))? true : false;
$thumb_html = wp_get_attachment_image( $thumb_id, 'thumbnail', $icon);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.