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 {@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_site_meta, get_file_data

Top Google Results

User discussions

wpseek mobile