Skip to content

Instantly share code, notes, and snippets.

@eddiemoya
Created July 2, 2012 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddiemoya/3035527 to your computer and use it in GitHub Desktop.
Save eddiemoya/3035527 to your computer and use it in GitHub Desktop.
Allow non-image mime-types in the multiple featured image plugin
// 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment