WordPress introduced the Post Thumbnails feature in version 2.9. In version 3.0, it was swiftly changed to Featured Image and has remained that way since then. A featured image is an image that is associated with a particular post. Imagine reading an online news magazine that has no image at all. You would be wondering, is it some holy scripture?
Images help convey the message being passed through in posts in a flash. I just see an image of Paul Pogba carrying a Europa league trophy and I immediately know Manchester United has just won that competition. I don’t have to read the article. It’s instant. I can read just for details like who scored or how did the game fare, but not for who won. I see you laughing in an image and I instantly know you were happy. I don’t have to ask if you were really happy. I may ask why you were happy. But whether your were happy or not isn’t a question any more.
Featured images help us get the gist of a post in an instant. However, if you have hundreds of posts that don’t have these images already, it’s very painful trying to set them one by one. It’s the situation I found myself in some years back. I had hundreds of technical posts, I wanted to show some thumbnails along with the post excerpts in either a grid or list. I thought about trying to edit them one by one and it wasn’t very wise for me. Given they were technical posts, I didn’t have to really set some particular image for only some particular post. It was okay to assign them relevant images according to category. Or even an easier but acceptable manner was just assign them random images.
This is what we will do in this lesson: How to set featured images randomly to bulk posts, or how to set featured images according to taxonomies. Let’s go.
Objectives
In this lesson we aim to:
- Assign featured images to bulk posts randomly.
- Assign featured images to posts according taxonomies like categories and tags.
Advantages of WP Random Post Thumbnails Plugin
We are using ‘WP Random Post Thumbnails’ plugin because:
- It’s free and easy to use.
- It allows us set featured images randomly to either bulk posts or bulk pages. We can also do this with custom post types.
- It allows us set featured images according to taxonomies like categories and tags. We can also do this with custom taxonomies.
- It receives regular updates.
Installation
To install our WP Random Post Thumbnails plugin:
- Head over to WordPress plugins’ portal. Search ‘Random featured Images’.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/962395443.png” alt=”Install Plugin” /> - Click ‘Install Now’ button to install our plugin.
- Once it’s installed, click ‘Activate’ button to activate the plugin.
Setting Featured Images
Once the plugin is installed and activated, let’s configure it:
- Click the Settings as shown below to move to settings page.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1491979228.png” alt=”Settings” />
- In the global options tab, let’s first add images from the media gallery. These are the images that will be set to the posts as featured images. Also choose the post type as well.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/2072937587.png” alt=”Global Options” />
- We set the images globally above. We can also set the images per post type in the second tab. However, we had already supplied our options in the first tab, so let’s just leave this empty.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1306961197.png” alt=”Post Type Options” />
- Next, we move to the taxonomy options tab. Here we can set featured images per taxonomy group. Let’s take category. Choose category as below and select images for that category. You can set multiple sets of categories.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/724976042.png” alt=”Category Images” />
- You can also set featured images per tag. You can add multiple sets of tags.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/196869316.png” alt=”Tag Images” />
Results
Let us see some results:
Random Images in List Posts
Here images are set for posts but not limited to any category or tag.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/150215171.png” alt=”Featured Images” />
Featured Images According to Categories
Here is the result for setting featured images according to categpries. Take note of the categories and the images we had assigned to them earlier.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1110279954.png” alt=”Category feature Image results” />
And that’s it.
Conclusion
Look, just as I had said earlier, I came to recognise the importance of this type of ability to set featured images randomly in one of my blogs some years back. It saved me time editing hundreds of posts. Those who had read my post ealier right here about mysql database optimization can see why editing so many posts isn’t a wise idea. Every revision you make in your posts get stored in the database as well. This bloats your database making it inefficient.
The best thing about this plugin is that you can also set images based on taxonomies like category and tags. The group of images you choose for a given taxonomy shall be set randomly of course. Images are an important visual aspect of a site design. Hence most posts should always have some images. This is not only for aesthetics but is also an important part of SEO(Search Engine Optimization). Images can improve search engine ranking of a given page.
WP Random Featured images makes assigning features images very easy. We therefore have no excuses of not setting featured images. Because not only do we humans like them but search engines do too.