How to Set a Default Fallback Image for WordPress Post Thumbnails

Are you willing to set a default fallback image for WordPress post thumbnails? Featured images, also known as post thumbnails are very useful when it comes to engaging more people in your blog and making your articles more noticeable on social media.

WordPress comes with tremendous numbers of fascinating features. One of those amazing features is the post thumbnail feature. This feature facilitates in enhancing your post by adding a custom featured image that represents your content.

Usually, WordPressers prefer to upload a unique featured image for each post, but some others prefer to set a default fallback image for WordPress post thumbnails. In this article, we will be discussing how you can set a default fallback image for WordPress post thumbnails.

But, before we begin, let us enlighten you about the importance of a default fallback WordPress post thumbnail. Post Thumbnail or Featured Image is a WordPress theme feature that allows you to associate an image with your blog post or article. It depends on your theme if the image will be used on homepage, archives, or sidebar widgets. By adding a fallback image, you can set a branded image to be used when no post thumbnail/featured image is found. This allows you to ensure that all your articles have a post thumbnail, by which your articles would not look broken or incomplete.

Having said that, let’s look at how to easily set a default fallback image for WordPress post thumbnails.

Set a Default Fallback Image for WordPress Post Thumbnails Using Plugin

This method is quite easy and is recommended for all the users, including the beginners as well. First of all, you need to install and activate the plugin—Default Featured Image. The plugin will help you add a default featured image to the media settings page.

Upon activation of the plugin, you need to visit the Settings > Media page to edit the plugin settings.

default featured image

Now you need to click on the Select Default Featured Image button to upload or select the image you would like to use as your fallback post thumbnail.

Click on the Save Changes button after you are done editing the settings. The plugin will now automatically start showing your default fallback image as post thumbnail for articles that do not have a specific featured image. You can visit your website and see it in action.

Set a Default Fallback Image for WordPress Post Thumbnails Manually

Adding a default fallback image manually requires you to add code to your WordPress theme files.

First, you need to create an image that you want to use as the default image. Next, you need to upload it to your theme’s images folder using an FTP client.

The images folder in your theme is located inside /wp-content/themes/your-theme/ folder. However, if it doesn’t have the images folder, then you need to create one. After you have uploaded the image to your website, the next step is to tell WordPress to look for the image when a post doesn’t have its own post thumbnail.

Your WordPress theme displays post thumbnails in various places. It could be in archive.php, cingle.php, or content templates.

Now you need to add the following code where you want to display the post thumbnail.

 <?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" />
<?php } ?>

Replace the default-image.jpg with the image file name that you want to see as a default post thumbnail.

That is it. Wasn’t that an easy task to do? Which method did you like the most to set a default fallback image for WordPress post thumbnails? Let us know through the comments.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *