Show the Featured Image Inside A Post On A Site Using Shortcode

  • Share on Pinterest

If you are looking at how to insert a featured image inside a post, you can try the following solution.

 Add the following code inside the functions.php of your theme:

function thumbnail_in_content( $atts ) {
global $post;
return get_the_post_thumbnail( $post->ID );

Control the features images with the shortcode:

[thumbnail size=medium align=right]

The side can be changed to small, medium and large values and/or align can be none, center, right or left.

Another way to control the thumbnail size with size=’array( 300, 200)’. It will look like this

[thumbnail size='array( 300, 200)']

Change the array value to a different number to achieve the result you need.

This site uses Akismet to reduce spam. Learn how your comment data is processed.