wp_attachment_is_image

函式
wp_attachment_is_image ( $post = null )
引數
  • (int|WP_Post) $post Optional. Attachment ID or object. Default is global $post.
    Required:
    Default: null
返回值
  • (bool) Whether the attachment is an image.
定義位置
相關方法
wp_get_attachment_imagewp_attachment_iswp_get_attachment_image_urlwp_get_attachment_image_srcwp_get_attachment_image_sizes
引入
2.1.0
棄用
-

wp_attachment_is_image: 這是一個條件標籤,用於檢查給定的附件是否是影象。如果附件是影象,它返回true,否則返回false。

確定一個附件是否是一個圖片。

關於這個和類似的主題功能的更多資訊,請檢視《主題開發者手冊》中的{@link Conditional Tags}文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_attachment_is_image( $post = null ) {
return wp_attachment_is( 'image', $post );
}
function wp_attachment_is_image( $post = null ) { return wp_attachment_is( 'image', $post ); }
function wp_attachment_is_image( $post = null ) {
	return wp_attachment_is( 'image', $post );
}

常見問題

FAQs
檢視更多 >