get_attachment_innerhtml

函式
get_attachment_innerhtml ( $id = 0, $fullsize = false, $max_dims = false )
引數
  • (int) $id Optional. Post ID.
    Required:
  • (bool) $fullsize Optional. Whether to have full size image. Default false.
    Required:
    Default: false
  • (array) $max_dims Optional. Dimensions of image.
    Required:
    Default: false
返回值
  • (string|false)
相關
  • wp_get_attachment_image()
定義位置
相關方法
get_attachment_iconget_attachment_linkget_attachment_icon_srcget_attachment_templatewp_get_attachment_url
引入
2.0.0
棄用
2.5.0

get_attachment_innerhtml: 此函式返回給定附件的HTML標記。

檢索影象元素的HTML內容。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
$id = (int) $id;
if ( !$post = get_post($id) )
return false;
if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
return $innerHTML;
$innerHTML = esc_attr($post->post_title);
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); $id = (int) $id; if ( !$post = get_post($id) ) return false; if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) return $innerHTML; $innerHTML = esc_attr($post->post_title); return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); }
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
	$id = (int) $id;
	if ( !$post = get_post($id) )
		return false;

	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
		return $innerHTML;

	$innerHTML = esc_attr($post->post_title);

	return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}

常見問題

FAQs
檢視更多 >