Get all our 20+ Elementor themes worth $609 at just $59! Limited time offer. Get It Now

WordPress Website Templates

Find Professional WordPress themes Easy and Simple to Setup

inner banner

Get WordPress Post Featured Image URL & Post Thumbnail

One of the WordPress theme features which allow the developers to add support when they are using an image for post or article is called featured image. It is also called post thumbnail by some WordPress functions and template tags.

The Codex page of WordPress featuring representative images also addresses this feature as post thumbnails instead of the featured image.

When you have WordPress post thumbnail feature you may ask the reason for getting WordPress feature image URL. Developers need the URL of the image if they want it as a background image instead of just a static image.

Use the built-in hooks of the WordPress to get the feature image URL by adding the code below. With the help of some codes, you can make changes in the feature image URL and how it should appear in the background of the theme.

wp_get_attachment_url( $id );

  1. For WordPress theme

    Post Thumbnail is a theme feature for the WordPress. Many themes used by the developers usually support the post thumbnail or featured image by default. If you are ambiguous about your theme compatibility, you can check by going to the post editor. Featured image option usually appears in the meta box when you create a new post.

    A simple snippet when added to the theme’s functions .php file can help to insert the featured image. Developers can then configure how to handle the uploaded images to WordPress. They have the option to choose the thumbnail size, styling and the ability to switch on and off the display of featured images.

  2. How to add post thumbnail

    When you start a new post, you can find the set featured image link. Click on it and you can find a metabox inside the media library. The user can now upload stock images from the gallery in the computer or images saved in the library. After selecting the required image, simply click on the set featured image located at the bottom. Images appear quite different from what they look on your theme. It depends on the theme features and how it handles photos.

    For example, take a look at online magazine posts. They tend to add small thumbnail images next to summaries of the post. But when you write a single post article, the featured image is fuller and larger. It is up to the choice of the content developer to alter the settings as to how to display the featured images.

  3. Adding post thumbnail for unsupportive themes

    Even though most of the themes support the featured image, there are some themes which are not compatible with such features. A little coding knowledge will help you to tweak your theme and makes it post thumbnail-friendly. The ‘post-thumbnails’ should be embedded in the added theme support code line of the theme functions .php file.

    add_theme_support( ‘post-thumbnails’ );

    This code is sufficient for the pages and posts to add the featured image to them. However, this code will only enable the theme to add post thumbnail feature but not necessarily display it in the WordPress theme.

    If you are keen on displaying the featured image in your theme, you need to start editing your templates and add a new code. Add this below code inside the post loop in which you need the feature image to appear.

    Once you add the feature image in the post, you need to customize its size suitable for the article or post. You can add a code with set width and height parameters to customize the post thumbnail. Add the code given below in the functions .php file of the theme.

    set_post_thumbnail_size( width, height);

    As mentioned earlier if you need to introduce different size thumbnails for different articles, add this below code for the single-post thumbnail.

    add_image_size( ‘single-post-thumbnail’, 590, 180 );

    With the help of coding, you can add any image and customize its size as per the need.

Featured images generally set the mood of the contents of the post or page. Add unique custom header images in your post to make it look interesting. Depending on the place where you need the feature image to be displayed, you need to insert the image appropriately in that position. For example, if your post contains no images and if you insert a featured image then the picture appears on the top of the post. If you want to add an image relevant to the post, then you need to add the featured image inside the post.

In one such case when you do not add a featured image to the post, the image embedded in the post will serve as the thumbnail and it is placed beside the post. Most of the time, feature images position and size and how they appear depends on the theme you have chosen.

Nikhil Aggarwal Author

I’m currently working as Content Manager with Web World Experts. I have a great passion for digital marketing and I help small and medium-sized businesses improve their online presence and grow their revenue by formulating effective digital marketing strategies for them. Apart from Digital Marketing, I have the keen interest in Web Development, Web Design Outsource, Graphic Design, Web Application Development technology, etc.