get_the_attachment_link
函数
get_the_attachment_link ( $id = 0, $fullsize = false, $max_dims = false, $permalink = false )
- 参数
-
-
(int)
$id
Optional. Post ID.- Required: 否
-
(bool)
$fullsize
Optional. Whether to use full size image. Default false.- Required: 否
- Default: false
-
(array)
$max_dims
Optional. Max image dimensions.- Required: 否
- Default: false
-
(bool)
$permalink
Optional. Whether to include permalink to image. Default false.- Required: 否
- Default: false
-
(int)
- 返回值
-
- (string)
- 相关
-
- wp_get_attachment_link()
- 定义位置
-
-
wp-includes/deprecated.php
, line 1866
-
wp-includes/deprecated.php
- 引入
- 2.0.0
- 弃用
- 2.5.0
Retrieve HTML content of attachment image with link.
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); $id = (int) $id; $_post = get_post($id); if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) return __('Missing Attachment'); if ( $permalink ) $url = get_attachment_link($_post->ID); $post_title = esc_attr($_post->post_title); $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); return "$innerHTML"; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。