get_image_tag


get_image_tag ( $id, $alt, $title, $align, $size = 'medium' )

Parameters:
  • (int) id Attachment ID.
  • (string) alt Image description for the alt attribute.
  • (string) title Image description for the title attribute.
  • (string) align Part of the class name for aligning the image.
  • (string|int[]) size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'medium'.
Returns:
  • (string) HTML IMG element for given image attachment
Defined at:

Description

Gets an img tag for an image attachment, scaling it down if requested.The {@see 'get_image_tag_class'} filter 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, {@see '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.

Related Functions

get_header_image_tag, get_the_tags, get_tag, get_file_data, wp_get_image_editor

Top Google Results

User discussions

wpseek mobile