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|array) size Optional. Registered image size to retrieve a tag for. Accepts any valid image size, 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 Array 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, Array, 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, wp_get_image_editor, get_site_meta

Top Google Results

User discussions

wpseek mobile