首页 WordPress函数大全 get_image_tag()

get_image_tag()

2020-05-01 / 5826阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_image_tag( int $id, string $alt, string $title, string $align, string|array $size = 'medium' )

Gets an img tag for an image attachment, scaling it down if requested.

描述

The ‘get_image_tag_class’ filter allows for changing the class name for the image without having to use regular expressions>‘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.

参数

$id

(int)
(Required)
Attachment ID.

$alt

(string)
(Required)
Image description for the alt attribute.

$title

(string)
(Required)
Image description for the title attribute.

$align

(string)
(Required)
Part of the class name for aligning the image.

$size

(string|array)
(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 value: 'medium'

返回

(string) HTML IMG element for given image attachment

大家谈论
    我的见解