is_attachment()

Sponsored Link

この条件タグは、添付ファイルが表示されている場合にチェックします。
添付ファイルは、投稿エディタのアップロードユーリティーを介してアップロードされた画像や他のファイルです。
添付ファイルは、独自の’ページ’またはテンプレートに表示することができます。
詳細については、イメージと添付ファイルを使用するを参照してください。

これはブール関数で、TRUEまたはFALSEのいづれかを返す意味です。

Sponsored Link

原文(翻訳元)This Conditional Tag checks if an attachment is being displayed. An attachment is an image or other file uploaded through the post editor’s upload utility. Attachments can be displayed on their own ‘page’ or template. For more information, see Using Image and File Attachments.

This is a boolean function, meaning it returns either TRUE or FALSE.

is_attachmentのテンプレートタグ使用方法

<?php is_attachment(); ?>

返り値

(boolean) 成功した場合にTrue、失敗した場合にfalseを返します。

原文(翻訳元)(boolean)
True on success, false on failure.

<?php
if ( is_attachment() ) {
// show adv. #1
} else {
// show adv. #2
}
?>

注釈

  • 参照: is_singular()
  • 添付ファイルのより具体的なチェックを参照してください:関数リファレンス/ WPの添付ファイルはイメージです。

原文(翻訳元)

  • See Also: is_singular()
  • For more specific checking of the attachment see: Function Reference/wp attachment is image

変更ログ

Since: 2.0.0

ソースファイル

is_attachment()は、wp-includes/functions.php内に位置しています。

原文(翻訳元)is_attachment() is located in wp-includes/functions.php.

関連テンプレートタグ

Conditional Tags: comments_open(), is_404(), is_admin(), is_archive(), is_attachment(), is_author(), is_category(), is_comments_popup(), is_date(), is_day(), is_feed(), is_front_page(), is_home(), is_local_attachment(), is_month(), is_new_day(), is_page(), is_page_template(), is_paged(), is plugin active(), is_plugin_page(), is_post_type_archive(), is_preview(), is_search(), is_single(), is_singular(), is_sticky(), is_tag(), is_tax(), is_taxonomy_hierarchical(), is_time(), is_trackback(), is_year(), in_category(), in_the_loop(), is_active_sidebar(), is_active_widget(), is_blog_installed(), is_rtl(), is_dynamic_sidebar(), is_user_logged_in(), has_excerpt(), has_post_thumbnail(), has_tag(), pings_open(), email exists(), post_type_exists(), taxonomy_exists(), term_exists(), username exists()

Sponsored Link