? Hooray! Today, the support team at SiteGround solved an issue that has been gnawing at me since the release of WordPress 4.7.
Disclosure: I may receive a portion of sales resulting from SiteGround affiliate links in this post.
When 4.7 released, I was stoked to see that PDF files uploaded to the media library would have associated thumbnails generated from the first page of the document. Why? Because it would allow me to provide a better user experience, like this. However, after updating my WordPress install, I found the feature still missing. Grr. After some investigation, I found that this feature required certain PHP modules be enabled on the site’s server and figured my shared hosting environment would probably need special attention. With other pressing responsibilities, I put off my investigation for a long time. Finally, today, I reached out to SiteGround support and am now the happy owner of a shiny new WordPress feature. If you’re also on SiteGround’s shared hosting, I expect you might also encounter the same. Here are the simple steps we took toward allowing this feature of WordPress to work properly. FTP or SSH into your account, perform these steps, and wonder at the beauty of it all!
Step 1: php.ini Modification
Modify or create a
php.ini file within the
/public_html/ directory of the your account, adding the following line to this file…
Step 2: .htaccess Modification
Add the following line of code to the
.htaccess file in
SetEnv PHPRC /home/****/public_html/php.ini
Note: Be sure to replace **** with your cPanel/FTP username
Step 3: Enjoy the Magick!
And, that should do it. WordPress will now generate a thumbnail for any new PDF files uploaded to your site.
Step 4: Generate Thumbnails for Previously Uploaded PDFs
But, what about all the PDF files that already reside in your media library? Here’s a quick way to generate thumbnails for those.
- Download, install, and activate Force Regenerate Thumbnails.
- Go to your Media Library (list mode).
- Filter PDFs.
- Check to select all.
- Apply Force Regenerate Thumbnails bulk action.
- Deactivate & remove the plugin.
To confirm that these steps have been successful, upload a PDF and ensure that you are immediately presented with a preview of the first page within your media library. And, that’s it. If you have any questions, I am sure your friendly SiteGround support will be happy to help. I’d be curious to see how you end up using PDF thumbnails. Send me anything you might cook up. I’d love to see and share.
Type On & Tell Your Story.
Add your email below and join the journey of a digital creative.