Plugin: Get Post Image 1
michaelbain has developed and deployed a plugin for WordPress.
This plugin makes a function available to WordPress to that can be used in your WordPress themes.
Who would use this plugin?
Theme designers that would like to include post images (where they aren’t normally displayed by WordPress) in their themes for example:
1. A thumbnail list of the last 10 posts.
2. An index page with the image of each last post per category.
3. An archive page per category with the image of the posts in that category.
This plugin is available under 2 licenses:
- Single site license: R 250
- Developer license: R 800
All payments by EFT when invoiced. We are unfortunately not accepting online payments at this stage.
Contact michaelbain for sales inquiries:
- Please tell us which plugin you would like to buy
- Please tell us which license option you are taking
- Please tell us who the invoice should be made out to
- We’ll invoice you and mail the package to you upon receipt of proof of payment
Read the below / the full article for information on what the plugin does and how to use it in your theme.
What does the plugin do?
1. Tries to get 1st image attachment from a post if available.
2. If that fails, gets the 1st image linked from the media library or linked form a URL.
3. If that fails, get the specified default image.
4. Returns an HTML IMG tag, for the found image – which will display the image in your theme, where you use the function.
WordPress does not provide a function to get library or URL linked images from a post, just attachments (uploaded from computer when post was created).
The function is intended to be used “in the loop”.
How do I use the plugin?
To use the function in your theme, install the plugin and simply call:
<?php mb_get_post_image(postid, size, defaultImgUrl, atts); ?>
… in your theme (in the loop) where you would like the post’s image displayed
Options for postid: $post->ID or 0.
Options for size: ‘thumbnail;, ‘medium’, ‘full’.
Options for defaultImgUrl: e.g. ‘http://www.server.com/deafaultimage.jpg’ or ””.
Options for atts: additional image tag atts eg. ‘class=”myclass” id=”7″‘ or “” or for no additional atts.
Images are sized when they are attachments and media library images.


Your plugin: get-post-image.. Super