Hi! My name is

NASTIA

I’m a WordPress enthusiast, proud to be WPMU DEV-ian, site builder and amateur photographer.

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

Nastia
0 Comments

If you are looking 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:

add_shortcode('thumbnail','thumbnail_in_content');
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.

Categories
WordPress
COMMENTS (No comments)

Leave a Reply

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