It’s the primary image for your blog posts, and it often appears next to the title on your homepage and social media. All popular WordPress themes come with built-in support for featured images .
In this article, we will show you how to easily add featured images or publish thumbnails in WordPress .
A beginner’s guide to featured images in WordPress
Featured images are a WordPress theme . So almost all WordPress themes come with built-in support for featured images , and display them beautifully across different areas of your WordPress site .
As humans, we find visual elements more engaging than plain text. Featured images help you make your blog pages look more attractive.
They also help you build user engagement and increase page views. Search engines and social media sites may use these images and display them in search results and social media news feeds as well
Featured images are mostly used for blog posts, but you can also set featured images for pages and custom post types.
Note : Featured images are not the same as the cover photo . Having said that, let’s take a look at how to easily add featured images in WordPress.
Add a thumbnail or featured image in WordPress
To add a featured image in a WordPress post , you just need to edit or create a new blog post.
In the content editor , you will find the Featured Image tab in the left column.
You need to click on the Set Featured Image area, and this will show the WordPress media upload popup.
From here, you can upload an image from your computer or use an existing image from your media library. Once you have selected the image, simply click on the Set Featured Image button.
WordPress will now display a preview of the featured image in the right column. However, the actual featured image will look different depending on your WordPress theme.
You can now save or publish your post and preview it to see how the featured image will appear on your live website.
Depending on the settings set by the theme developer, your featured image will automatically appear with your posts.
How to find featured images and use them effectively ?
Now, the next big question most beginners face is where to find images to use as featured images?
You can’t just use Google image search and use any image from the internet. These images are protected by copyright laws and using them without proper permission can cause legal trouble.
Fortunately, there are many resources available that you can use to find free images for your blog posts.
Our top favourites :
Shutterstock : They have a few free stock photos, but the real value comes from their paid plans that give you access to tons of high-quality photos, illustrations, graphics, videos, and more. This is what we use for dr-wp.
Unsplash : A popular online resource that posts high-resolution images that you can use on your website and other projects.
Negative Space : Well-curated collection of copyright-free images.
New Old Stock : A collection of old photographs from public archives.
Theme Developers Guide to Featured Images and Post Thumbnails in WordPress
Featured image is a popular feature that is supported by almost all WordPress themes. On rare occasions, you may come across a theme that does not support featured images, or you may not like how featured images are handled.
In this case, you can add featured image support to your theme or change how it looks.
If you’re comfortable editing WordPress theme files and know your way around a little custom CSS, you can do it yourself.
If your theme does not support featured images, you will not see the option to add a featured image in the content editor.
To add featured image support in your wordpress theme, you need to add this line of code in your theme’s functions.php file :
1 |
add_theme_support( 'post-thumbnails' ); |
This code will enable featured images support for posts and pages. You can now go to the post or page block editor, and you will see the Featured Image option enabled.
However, when you set a featured image, it will not automatically display in your WordPress theme. To display featured images in your theme, you need to edit your templates and add this line of code where you want the featured image to display :
1 |
<?php the_post_thumbnail(); ?> |
The files you add the above code to will differ depending on your version. You’ll want to add the code inside your post loop.
The above code is the basic functionality you need to add support for main images and display main images in your theme. To set the image size for the featured images you upload, you need to add this line of code to your functions.php file .
1 |
set_post_thumbnail_size( 50, 50); |
The set_post_thumbnail_size parameters are in the following order: width, height. You can also set additional image sizes to use with the_post_thumbnail() function. For example :
1 2 |
// Image size for single posts add_image_size( 'single-post-thumbnail', 590, 180 ); |
In this example, we’ve added a new image size called Single Thumbnail with a width of 590 pixels and a height of 180 pixels.
To use this image size in our theme, we’ll still need to add it to the appropriate theme file.
If you previously uploaded featured images, but they still appear in some other sizes, you need to recreate the thumbnails and image sizes for older posts.
Below is an example of the feature image function with a specific image size.
1 |
<?php the_post_thumbnail( <strong>'single-post-thumbnail'</strong> ); ?> |
Questions and answers about featured images in WordPress
As a beginner, you may encounter questions or problems when using featured images on your blog. Here are some of the most frequently asked questions about main images.
Why does the featured image appear twice in my posts?
Sometimes beginners add a featured image and then add the same image inside the content section of the post editor.
All you have to do is remove the image from the content area and just use the featured image meta box to add a featured image.
What is the difference between a cover photo and a featured photo?
Cover images are used in the content area of your posts or pages. They are usually used to separate different sections of a page or a lengthy post.
The featured image is a representative image of the article. It does not appear before or next to the content but not within the actual article.
How are featured images displayed next to recent blog posts?
The WordPress theme editor comes with a “Recent Posts” block which allows you to view recent posts using post thumbnails. You can also display recent posts with thumbnails in sidebar widgets using the Recent Posts Widget Extended plugin . Check out our guide on how to install add-ons .
How to remind authors to add a featured image in WordPress?
Featured images are displayed prominently on your homepage, blog page, and other archive pages.
If you or another author on your blog forgets to set one and publish the post, it will appear without a main image. This will look bad and inconsistent, which is not good for user experience.
You can install and activate the Require Featured Image plugin, which will display a notification when anyone tries to publish a post without a main image.
We hope this article helped you learn how to add main images or post thumbnails in WordPress . You may also want to check out our beginner’s guide to image SEO which shows how to optimize your WordPress images for search engines.