get_image_tag [ WordPress Function ]
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
An <img src /> tag for an image attachment, scaling it down if requested.
The filter 'get_image_tag_class' allows for changing the class name for the image without having to use regular expressions on the HTML content. The parameters are: what WordPress will use for the class, the Attachment ID, image align value, and the size the image should be.
The second filter 'get_image_tag' has the HTML content, which can then be further manipulated by a plugin to change all attribute values and even HTML content.
Source
<?php
function get_image_tag($id, $alt, $title, $align, $size='medium') {
list( $img_src, $width, $height ) = image_downsize($id, $size);
$hwstring = image_hwstring($width, $height);
$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" />';
$html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
return $html;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- get_image_tag Wordpress hook details -- Adam Brown, BYU ...
Detailed information about every action hook and filter used in WordPress. Makes Plugin API easier to use. Lists appearance, file location, and deprecation data ...
adambrown.info - images - What's the proper way to use the get_image_tag filter ...
Jun 2, 2011 ... I'm attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get_image_tag filter is the way to do this.
wordpress.stackexchange.com - Function Reference/get image tag « WordPress Codex
Description. An <img src /> tag for an image attachment, scaling it down if requested. The filter 'get_image_tag_class' allows for changing the class name for the ...
codex.wordpress.org - WordPress › Support » Having Trouble with get_image_tag filter
I get the feeling I'm not handling the arguments on get_image_tag correctly, but I don't know what is going wrong. I'm still pretty new with filters/actions, so this ...
wordpress.org
Kullanýcý Tartýþmalarý [ wordpress.org ]
- alex20hz on "Add new data attribute into get_image_tag function"
- alex20hz on "Add new data attribute into get_image_tag function"
- alex20hz on "Add new data attribute into get_image_tag function"
- Ian Dunn on "Having Trouble with get_image_tag filter"
- mrwweb on "Having Trouble with get_image_tag filter"
- Ian Dunn on "Having Trouble with get_image_tag filter"
- mrwweb on "Having Trouble with get_image_tag filter"
- Ian Dunn on "Having Trouble with get_image_tag filter"
- mrwweb on "Having Trouble with get_image_tag filter"
- mrwweb on "Having Trouble with get_image_tag filter"