Simple Image Grabber WordPress Plugin

I created a plugin for the function I talked about in my post Retrieve and Display Images from a WordPress Post just in case there is anyone out there who isn’t a fan of hacking code. Just install this sucker and use the following function:

Make sure it is within the loop and it will display whichever image you want.
$number = the image you want to pull from your post, ie. the first image from the post (‘1’) or the second image from the post (‘2’) and so on. NOTE: If you use ‘all’, it will display all images from the post.
$width = the width of the displayed image
$height = the height of the displayed image
$class = the class name you would like to assign to the displayed image
$link = whether you would like the displayed image to link to the post or not
So, the following function:

would display the second image from a post (if there is one) with a width of 150px and a height of 200px, the class name alignleft and no link to the post.
The following:

would display all images from a post with their original width and height, a class name of alignright and a link to the post.

Share this:

Email
Facebook
Twitter
Pinterest
Pocket

Premium Themes for WordPress

Looking for an easy-to-use Premium Theme for WordPress? Check out Themes by bavotasan.com and have your site up and running in no time.

Use this WordPress website builder to build powerful websites in no time for your or your clients.

WordPress Hosting

WP Engine – designed from the ground-up to support and enhance the workflow of web designers.

Bluehost – providing quality web hosting solutions since 1996.

About the author

Picture of Luke Perrie

Luke Perrie