Featured Image & Post Thumbnail in WordPress

In this article you will learn how to use featured image in WordPress. Usually all of the themes have featured image facility enabled. So we will explain how to use featured image. Later on we will guide you through some developer option to add option of feature image if it’s not enabled. Intro to Featured […]

Share

In this article you will learn how to use featured image in WordPress. Usually all of the themes have featured image facility enabled. So we will explain how to use featured image. Later on we will guide you through some developer option to add option of feature image if it’s not enabled.

Intro to Featured Image:

Featured image usually called Post Thumbnails in WordPress. Which considered as a powerful option. Currently every single theme use this function (e.g. WordPress photography themes, Online stores, Product Showcase). This was called Post Thumbnails in the version 2.9 but later they called it featured image.

Check Theme Support Feature Image or Not:

If you want to make sure you Featured image or post thumbnail supported by your theme you need to follow some of the steps to ensure it.

  1. Go to your WP-Admin, Click Add New in Post Menu.
  2. Scroll to the Bottom of the page You will see a Box called Featured Image.
  3. People asked Featured Image in my theme is not available.
  4. Scroll to the top of your page and Click Screen Options Check either your featured image check box is tick or not.

How to Add Featured Image in Post (Beginner)

If you are standing in New Post then scroll down and at the Featured Image section.

  • click Set Featured Image.

    Featured Image in WordPress TwoClock

    Featured Image in WordPress TwoClock

  • It will show you WordPress Media Uploader. Upload your desired picture or select a picture from Media Gallery.
    Media Uploader Post Thumbnail WordPress Twoclock
  • The picture you select or upload will have a check box appear on it. Simply click Set Featured Image.

Note: The image size may differ and vary according to the theme. It means the image you upload will not show exactly as you upload. As usual size may differ.

Post Thumbnails & Featured Image Developer Guide

Now a day’s almost every theme give featured image functionality in order to facilitate the admin to give a better look to the theme. Some how many of theme didn’t give facility. Even if you want to add Post Thumbnail beside theme is not supporting then you need to add some lines of code to enable featured image supported by theme.

To add featured image support in a WordPress theme, you need to add this line of code in your theme’s functions.php file:

add_theme_support( ‘post-thumbnails’ );

This code will enable featured image support for posts and pages. You can now go to posts or pages, and you will see 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 to display the featured image:

<?php the_post_thumbnail(); ?>

The files you add the above code in will vary based on your theme. You will want to add the code inside your post loop.

The above code is the basic function that you need to add featured image support and display featured images in your theme. To set image size for featured images you upload, you need to add this line of code to your functions.php file.

Below is an example of the featured image function with a specific image size.

set_post_thumbnail_size( 50, 50);

The parameters for set_post_thumbnail_size are in this order: width, height.

You can also set additional image sizes to use with the_post_thumbnail() function. For example:

// Image size for single posts
add_image_size( ‘single-post-thumbnail’, 590, 180 );

In this example we have added a new image size called single-post-thumbnail with 590px with and 180px height. To use this image size in our theme, we will still need to add it in the appropriate theme file. Checkout our guide on adding additional image sizes in WordPress for more details.

If you have previously uploaded featured images, but they are still appearing in some other size, then you need to regenerate thumbnails and image sizes for older posts.

Below is an example of the featured image function with a specific image size.

<?php the_post_thumbnail( ‘single-post-thumbnail’ ); ?>

This is broken down version of the full functionality. You can further extend the functionality of featured images. For example, you can set a default fallback image for post thumbnails, display featured images with captions, or even add multiple post thumbnails or featured images.

We hope that this article helped you learn how to add featured images or post thumbnails in WordPress. If you have any questions or suggestions, then please let us know by leaving a comment below.

 

wpbeginner.com/beginners-guide/how-to-add-featured-image-or-post-thumbnails-in-wordpress/

Leave a Reply

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