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.

📣 Join our live AMA on the Future of Page Builders with Brizy's CEO! Register Now →

How to Add Featured Images in a WordPress Website

Updated on April 7, 2021

2 Min Read
WordPress Featured Image

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 choosing 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 performance-optimized web hosting for wordpress 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

Share This Article

Ahsan Parwez

Ahsan is the Community Team Manager at Cloudways. 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.

×

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

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now