WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Use the Attachment Image!

Allows the first attachment image associated with a post to be used in different locations throughout a blog.

To utilize this plugin, you will first need to upload use_attachment_image.php to the /wp-content/plugins/ directory on your web server; and activate the plugin through the 'Plugins' menu in WordPress.

Next, place <?php use_the_attachment_image() ?> (will include a link to the post), or <?php use_the_attachment_image_nolink() ?> (will NOT include a link to the post) in your template to include a thumbnail of the first attachment image. Note the function must be inside of a WordPress loop.

By default, this function will include a thumbnail image. To include images of different sizes, use the respective functions below. You may also use <?php use_the_attachment_image_nolink() ?> in place of <?php use_the_attachment_image() ?> here.

Thumbnail <?php use_the_attachment_image('thumbnail'); ?>
Medium <?php use_the_attachment_image('medium'); ?></p>
Large <?php use_the_attachment_image('large'); ?></p>
Full <?php use_the_attachment_image('full'); ?>
20 px <?php use_the_attachment_image(array(20,20)); ?>
Feel free to replace 20px with another specific size to best meet your needs. Note that WordPress will scale a larger image down to give you the size you desire here.

It is possible to include a thumbnail image from each post in your RSS feed. To do this, simply add this code to your theme's functions.php file. From cd harrison.

<?php
function insertAttachmentRSS($content) {
   global $post;
   { $content = use_the_attachment_image() . $content; }
   return $content;
}
add_filter('the_excerpt_rss', 'insertAttachmentRSS');
add_filter('the_content_feed', 'insertAttachmentRSS');
?>

See an example of how this plugin can be used.

If you have any questions about this plugin, feel free to ask on my website, and I will respond as my time allows.

Requires: 2.7 or higher
Compatible up to: 3.9.1
Last Updated: 2014-4-20
Downloads: 2,950

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1