Created
August 27, 2021 15:10
-
-
Save jessekanner/33b901584be9e0ade130fa34c748437c to your computer and use it in GitHub Desktop.
Display a PDF thumbnail in WordPress front end
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
| /* --- Used to display thumbnails automatically created by WordPress --- */ | |
| // Get attachement ID (this is circuitous, but seems to be the most "wordpress" way w/o needing plugins, etc | |
| $attachment_id = array_keys(get_attached_media('*,*',$post->ID))[0]; | |
| // Once you have the attachment_id, proceed as normal | |
| echo wp_get_attachment_image( $attachment_id, 'full', $icon, $attr ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment