Display featured image in WordPress post as full, large, medium, thumbnail size

Every available WordPress theme doesn’t give you the option to control if you want to show featured image in a post or in what size you want to display them.

The image is crucial for your blog post as it’s probably first thing audience notice.

For ex, I am using Hueman theme and that doesn’t display featured image in single post. Here is what I did and thought to share so you can be benefited.

  • Go to your theme directory
  • For ex: wp-content/themes/hueman
  • Take a backup of single.php
  • Edit single.php and search for <?php the_content(); ?>
  • Add following above the <?php the_content(); ?>
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( 'full' );
}
?>
  • Save the file and refresh your wordpress to see them in action.

Above code will show featured image in the single post as original image size. This is how single.php will look like.

featured-image-wordpress-post

If you want to control the size, you can change the_post_thumbnail parameter.

To display default thumbnail size (default 150px x 150px max)

the_post_thumbnail();

To display in medium size (default 300px x 300px max)

the_post_thumbnail( 'medium' );

To display in large size (default 640px x 640px max)

the_post_thumbnail( 'large' );

To display in original uploadedsize

the_post_thumbnail( 'full' );

This has helped me and I hope you too. Don’t forget to compress your images with these awesome free online image compressor tool. Let me know how it goes with your theme.

Reader Interactions

Comments

  1. Great post, simple back to basics.. Ive been busy with a custom theme design and stumbled across this post. Sometimes the simple solutions work best. 🙂

  2. Ah, I just found the ridiculously-easy way to include the feature image in the single post page; when editing the post, simply change its type from Standard to Image; the only difference is that the Image type includes the feature image in the single post.

  3. Rather than put the mods in the theme’s simple.php file, which will get overwritten the next time the theme is updated, create a child-theme (the plugin “Childify Me” makes it easy), and copy the simple.php file from the themes/hueman directory to the themes/hueman-child directory, and make the mods there.

    (I had earlier reported that this doesn’t work, but I must’ve had a typo or something, because I just tried it again and it works as expected, at least for the “medium” size.)

  4. What about many posts in one page.
    for ex. catalogue for movies and there are many movies(posts) in one page still not filtered.

Comments

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