Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

WordPress 5.2 "Jaco" released with PHP Error Protection & Site Health Check Feature READ MORE

How to Add Featured Images in a WordPress Website

Updated on April 15, 2015

2 Min Read
WordPress Featured Image
Reading Time: 2 minutes

Visually appealing websites and pages have the tendency to grab users attention. Most Web Marketing experts suggest that using related images to convey messages provides a better chance of user engagement.

Having images paired up with your headlines and text can improve the CTR and visitor flow on your website. WordPress is used to build all sorts of websites, from blogs to ecommerce stores and forums to business websites, and there are many themes available to suit your needs.

But if you are using a theme that doesn’t support the functionality to add WordPress featured image, then adding support for it will prove useful.

In most themes, the featured image in the WordPress option is already enabled. However, if you are unable to see the featured image option while creating a post, then you would need to enable a featured image in WordPress.

No Featured Image

To enable the support for WordPress featured images, you need to add just a single line of code to your functions.php file in your WordPress theme folder. You can access the folder through an FTP client like FileZilla.

Now, connect to your web server with FileZilla and navigate to content > themes > (your theme) and find functions.php. Open the functions.php with a file editor like Notepad++ and add the following line of code:

add_theme_support( 'post-thumbnails' );

Save the file and upload the new functions.php file to your theme folder. To check whether you have integrated it correctly, navigate to your WordPress admin panel and click on “Add new” to create a fresh post. You will see that the “Featured Image” option is now enabled for your website.

Even though the theme support is enabled, your Featured image might not show up on the blog’s home page. To fix that, you need to add a bit of code inside The Loop in the index.php file.

Featured Image

Add the following line inside The Loop of index.php file

if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { }

The final Loop code will look something like this:

<?php if ( have_posts() ) : ?>

<?php while ( have_posts() ) : the_post();

if ( has_post_thumbnail() ) { the_post_thumbnail(); }

else { } ?>

has_post_thumbnail() – Returns true if the post has a Featured Image in it.

the_post_thumbnail() – Calls and displays the image in the loop.

And, you are done! Now, you will have your Featured Images showing up on the front page of your WordPress blog, along with post content.

Just be a bit careful with uploading heavier images on your themes. It can slow down your website. For a faster website, you need a performance-optimized WordPress hosting platform like Cloudways.

If you still have any questions about enabling this functionality, then feel free to ask in the comments section.

Share your opinion in the comment section. COMMENT NOW

Ahsan Parwez

Ahsan is the Community Team Manager at Cloudways - A Managed Cloud Hosting Platform. He loves to solve problems and help Cloudways' clients in any aspect he can. In his free time, you can find him playing RTS PC games.

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

THERE’S MORE TO READ.