Home › Forums › Feature Requests › Show PDF Thumbnails on file uploads if available › Reply To: Show PDF Thumbnails on file uploads if available
Hello,
FYI, I had same issue and did this hook to make it:
function acf_change_icon_on_files ( $icon, $mime, $attachment_id ){ // Display thumbnail instead of document.png
if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) === false && $mime === 'application/pdf' ){
$get_image = wp_get_attachment_image_src ( $attachment_id, 'thumbnail' );
if ( $get_image ) {
$icon = $get_image[0];
}
}
return $icon;
}
add_filter( 'wp_mime_type_icon', 'acf_change_icon_on_files', 10, 3 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.