The jist of it is, this plugin finds the images that are attached to a post and displays those images. This plugin is a simplified version of post-image.php by Kaf Oseo with one major enhancement. You can choose which image you want display rather than only displaying the first image uploaded.
Usage
<?php get_image('image_position', 'class', 'url_only'); ?>
Parameters
- $image_position
- (integer) Allows you to specify which image to display from the array of images attached to the post. Default is 0.
- $class
- (string) Specify what class you want the returned image to have. There is no default.
- $url_only
- (boolean) Return only the image url (TRUE) or return the image itself (FALSE). Default is FALSE.
Examples
get_image can only be used inside the WordPress Loop. This code returns the second image from the attached images array and specifies a class of “postImage.”
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_image(2, "postImage"); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Notes
In order to get predictable results, you must specify the order of the uploaded images under the gallery tab of the images dialog.
I make no warranties with this plugin. By downloading and using this plugin, you agree to not hold me liable for any damages to you site, computer, or anything else you hold valuable.
Download
[drain file 1 show]