Hello, I'm Aaron Harun, a New York based
Traveler, Developer and Web Consultant.
You're about to have an "AaHa!" moment.

WordPress Post Featured Image Shortcode

The Featured Image Shortcode plugin is a 5-line plugin that adds a simple shortcode to insert the post’s thumbnail. (This is also referred to as the Featured Image by WordPress). Adds a [ post_thumbnail ] shortcode for use with wordpress post thumbnails. Also accepts [ post_thumbnail size="" ]. It only works for WP versions 2.9 and higher.

A Post Thumbnail is an image that is chosen as the representative image for a Post or Page. The display of this images is up to the theme. This is especially useful for “magazine-style” themes where each post has an image.

Use:

Use of this plugin is simple. If your theme supports Featured Images/ Post Thumbnails, you will see a box like the one in the screenshot that allows you to set a “featured image.” Once this image is set the Admin panel, add [ post_thumbnail ] into the post’s content and it will auto-magically insert the image you set. Just remember to remove the spaces.

I use this plugin to add the post thumbnails into the content of articles. See, on my blog page the images are being added in the theme, but on an individual article like this one for Moving WordPress the same image appears under the first paragraph.

You can also call the function directly in your theme with <?php post_thumbnail('size=thumbnail');?>. However, you are better off using the main WordPress function <?php echo get_the_post_thumbnail(null,'thumbnail');?>.

This Plugin requires that you be using WordPress 2.9 and have the feature enabled in your theme’s functions.php file. If you don’t have it enabled, see below on how to add post thumbnails.

Download:

Download Latest WordPress Post Thumbnails Shortcode Keys

Installation:

Use the one-click installer! WordPress One-Click plugin install.

Or

  1. Download the zip file, unzip it and upload to your wp-content/plugins folder
  2. Upload to your plugin directory.
  3. Activate.

The plugin is hosted in the WordPress Extend database so you can also manually install from your wordpress admin panel

  1. Go to “Add New” under Plugins
  2. Search for “Featured Image Shortcode”
  3. Click install now, confirm and follow any other instructions you are given.

How do I enable post thumbnails on my theme?

The code you have to add is:

if (function_exists('add_theme_support')) {
	add_theme_support('post-thumbnails');
	set_post_thumbnail_size(50, 50, true); //Sets the default image to 50x50px and crops it
	add_image_size('post-hero', 590, 150, true); //Adds the large style images
}

To add the second custom sized image to the post, I use [ post_thumbnail size="post-hero" ]. It’s as easy as that. You can read more about enabling this feature in your themes here.

Posted in
13 comments on “WordPress Post Featured Image Shortcode
  1. It is regularly updated to keep at par with the latest software. With a controller you just feel so constricted and you never forget that you’re the one guiding the character on screen. DOWNLOAD THE CHEAT TOOL FOR ASSASSIN’S CREED PIRATES FROM HERE.

  2. dee says:

    hi, i wonder if it is easy to give every displayed post thumbnail a transparent overlay automatically? (like a play button)

    must be easy i think but it has been years since i did php.. suggestion welcome!

    greetings, david

  3. Paul says:

    Can you give an example of [post_thumbnail size=""] shortcode in use? No matter what size I specify, the image appears full size.

    • Talita says:

      You should use the values “thumbnail”, “medium”, “large” or “full” to get the sizes predefined by your theme, e.g. [post_thumbnail size="medium"].

  4. Jacob Chapman says:

    Shweet! So… would <?php post_thumbnail size="post-hero"?> also work [directly inside my theme]? If not, could you get that to work in the next update? Thank you!!

  5. Ehsan says:

    Hi How can I use the featured image in my theme? the link you supplied doesn’t seem working! :(

  6. ritchie says:

    Where in my function.php i have to past it? because when i paste it in the document i got a syntax error?

  7. meg says:

    where should i add this code?: if (function_exists(‘add_theme_support’)) { add_theme_support(‘post-thumbnails’); set_post_thumbnail_size(50, 50, true); //Sets the default image to 50x50px and crops it add_image_size(‘post-hero’, 590, 150, true); //Adds the large style images }

Leave a Reply

Standard Rules Apply: Use <code> tags for code snippets. Keep it relevant. Other than that, be your awesome self.

*(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

`