This plugin provides the template tag wp_get_post_image(). Use it to call dynamically created images uploaded via the WordPress media uploader.
NOTE: This plugin is intended for use by WordPress developers and theme builders only.
Usage
Default Usage
null,
'height' => null,
'css' => '',
'parent_id' => '',
'post_id' => '',
'filename' => '',
'return_html' => true
); ?>
By default, the function returns:
- The last uploaded image wrapped in an image tag (
). - A proportionately sized image with a
widthno greater than200px. - The CSS class
wp-image-*ID*and no other classes. - If you add
thickboxviacss, the appropriate anchortag will be added for Thickbox compatibility.
Parameters
-
width (integer) – Width of image.
-
height (integer) – Height of image.
-
parent_id (integer) – The ID of the
post_parentfor the attachment. Specifying theparent_idreturns the first image attached to the parent post according tomenu_order. -
post_id (integer) – The ID of the attachment.
-
filename (string) – The filename that corresponds to the
post_nameof the attachment. -
return_html (boolean) –
truereturns the image wrapped in an XHTML image tag.falsereturns the image’s URL.
Example
ID, e.g. the WordPress loop
if(function_exists('wp_get_post_image'))
echo wp_get_post_image('width=450&css=alignleft&parent_id='.$post->ID);
?>
Active installations100+
Weekly downloads
11-8.33%
Version0.2
Last updated6/26/2010
WordPress version2.8.4
Tested up to3.0.5
Tags
attachmentsfunctionimagespost imagetemplate tag