How do I change the default post thumbnail for WordPress? Let’s use this article to discover the answer. Skynats responds to inquiries about WordPress as part of our Server Management Services.
How can the default fallback image for WordPress post thumbnails be set?
A WordPress theme feature called post thumbnails also referred to as featured pictures, enables users to link an image to a blog post or article. Based on the theme, this image is then added to the homepage, archives, or sidebar widgets. If we fail to include one, the picture won’t be in the article. The layout will therefore appear flawed.
When no post thumbnail is found, the default fallback image will be used to avoid such occurrences. Let’s examine how to quickly set up a fallback image for WordPress post thumbnails.
Solution 1
- To begin, you will need to download the WordPress Default Featured Image plugin and then install it.
- To change the plugin settings, navigate to the Settings » Media page.
- To upload or choose the image we want to use as the fallback post thumbnail, click the ‘Select default featured image’ option on the new page.
- Select “Save changes” from the menu.
- Finally, we can go to the website to see how it works.
Solution 2
This approach makes use of codes on the WordPress theme files. Setting the default fallback image for WordPress post thumbnails involves the steps listed below:
- First, make the image that we want to use the default image.
- Then, using any FTP client, upload it to the images folder of the WordPress theme. The images folder for the theme is located in /wp-content/themes/yur-theme/. If it doesn’t already have an image, we’ll need to make one.
- If a post lacks its post thumbnail, instruct WordPress to search for this image. Post thumbnails can be found displayed in multiple locations across the WordPress theme. Look for the post thumbnail() in the theme files. Generally, it can be found in single.php, archive.php, or content templates.
Include the code below where you want the thumbnail to appear.
<?php if( has_post_thumbnail() ) {the_post_thumbnail();} else{ ?><img
src=”<?php bloginfo(‘template_directory’); ?>/images/default-image.jpg”alt=”<?
php the_title(); ?>”/><?php } ?>
- Additionally, substitute our image file name for default-image.jpg.
- To see it in action, we can finally visit the website.
Are you looking for an answer to another query? Contact our technical support team.