- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/the attachment link
目次
Description
Outputs an HTML hyperlink to an attachment file or page, containing either
- A full size image or thumbnail for image attachments; or
- The attachment's title (as text) for non image attachments
If no attachment can be found, the function displays the string Missing Attachment.
Usage
%%%<?php the_attachment_link( $id, $fullsize, $deprecated, $permalink ); ?>%%%
Default Usage
<?php the_attachment_link( 7 ); ?>
Parameters
- $id
- (integer) (Optional) ID of the desired attachment.
- 初期値: The current post ID, when used in The Loop (Must be a loop showing only attachments).
- fullsize
- (boolean) (Optional) For an image attachment, use the original image (true) or Wordpress-generated thumbnail (false). If set to false and the thumbnail can't be found, the full-size image may be used instead.
- 初期値: 'False'
- 1 (True)
- 0 (False) - Default
- $max_dims
- (array) (Deprecated parameter since Version 2.3) Maximum width and height of the image or icon, applied to the width and height attributes of the image element (img) output by the function. The aspect ratio is kept constant
- 初期値: not used
- $permalink
- (boolean) (Optional) Link directly to the attachment file/image (Default), or to the attachment page.
- 初期値: 'False'
- 1 (True)
- 0 (False) - Default
Examples
<?php // Show an image at full size linked to the attachment file the_attachment_link( 4, true ); // Show a thumbnail linked to the attachment page the_attachment_link( 4, false, false, true ); ?>
Notes
Use wp_get_attachment_link() instead if you just want to get the hyperlink, not print it.
Change Log
Since: 2.0.0
Source File
the_attachment_link() is located in 構文エラー: "tags" は認識できません/src/wp-includes/post-template.php wp-includes/post-template.php
.
Related
添付ファイル関数: get_children(), get attached media(), the_attachment_link(), get_attachment_link(), wp_get_attachment_link(), wp_get_attachment_image(), wp_get_attachment_image_src(), wp_get_attachment_url(), wp_get_attachment_thumb_file(), wp_get_attachment_thumb_url(), is_attachment(), wp_get_attachment_metadata()