વર્ણન
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
<?php wp_get_post_image($args); ?>
Default Usage
<?php $args = array(
'width' => 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 (
<img />). - 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 anchor<a>tag 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
<?php
// use this example wherever you have access to $post->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);
?>
સ્થાપન
Install the plugin as follows:
- Upload the folder
wp-get-post-imageto the/wp-content/plugins/directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Place
<?php echo wp_get_post_image(); ?>in your templates
એફએક્યુ (FAQ)
No questions yet.
સમીક્ષાઓ
આ પ્લગઇન માટે કોઈ સમીક્ષાઓ નથી.
ફાળો આપનાર & ડેવલપર્સ
“WP Get Post Image” ને તમારી ભાષામાં અનુવાદ કરો.
વિકાસમાં રસ ધરાવો છો?
કોડ બ્રાઉઝ કરો, જોવોઅસ્વીએન રેપોઝિટરીમાંથી,અથવા સબ્સ્ક્રાઇબ કરોડેવલપમેન્ટ દ્વારાઆરઅસઅસ.
ચેન્જલૉગ
0.2 (2010-01-26)
- Adjusted
$image->basepathto referenceget_bloginfo('wpurl')instead ofget_bloginfo('url'). This makes the plugin work when WordPress is installed in one directory while the blog displays in another. (HT: Mike Cohen)
0.1 (2009-11-23)
- first version