Get Image from Post

Description

** this plugin is no longer being update. Please feel free to adopt me! **

This is a simple plugin which allows users to return an image from the related post.

This plugin is maintained by Christopher Ross, http://thisismyurl.com or you can find him on Twitter at http://twitter.com/thisismyurl/

Updates

Updates to the plugin will be posted here, to thisismyurl.com

Donations

If you would like to donate to help support future development of this tool, please visit http://thisismyurl.com/

FAQ

How do I display the results?

Insert the following code into your WordPress theme files:

General results

Without passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.

thisismyurl_get_image_from_post();

Altering the before and after values

By default the plugin wraps your code in list item (<li>) tags but you can specify how to format the results using the following code:

thisismyurl_get_image_from_post(‘before=<p>&after=</p>’);

Adding a Link

If you’d like to link to the post (remember it’s not live yet) you can do so by calling:

thisismyurl_get_image_from_post(‘link=true’);

Which image?

You can specify which image is returned using the code:

thisismyurl_get_image_from_post(‘image=2’);

Strip Attributes

If you would like to strip the attributes such as width and height from the returned value:

thisismyurl_get_image_from_post(‘strip=true’);

Echo vs. Return

Finally, if you’d like to copy the results into a variable you can return the results as follows:

thisismyurl_get_image_from_post(‘show=false’);

Changelog

2.0.0

  • renamed function to be more compatible.
  • tested and optimized in WordPress 3.2
  • added test to determine in images existed

1.0.0

  • official release
  • added strip attribute

1.1.0

  • minor fixes for wordpress new admin

Contributors & Developers

This is open source software. The following people have contributed to this plugin.

Contributors

Browse the code