- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「テンプレートタグ/get day link」の版間の差分
細 (→関連項目: {{原文|Function_Reference/get_day_link|141059}} <!-- 16:39, 7 February 2014 Johnciacia 版 -->) |
細 (→説明) |
||
2行目: | 2行目: | ||
特定の日別アーカイブページへのURLをPHPの値として返す。ループ内・外で使用。 | 特定の日別アーカイブページへのURLをPHPの値として返す。ループ内・外で使用。 | ||
− | + | [[Glossary#PHP|PHP]]で使用するための特定の年、月、日の毎日のアーカイブの[[Glossary#URI and URL|URL]]を返します。 | |
− | + | これは、URLが表示されません。年、月、日のパラメータが<tt>''</tt>に設定されている場合、タグは現在の日のアーカイブのURLを返します。 | |
== 使い方 == | == 使い方 == |
2015年8月25日 (火) 20:31時点における版
説明
特定の日別アーカイブページへのURLをPHPの値として返す。ループ内・外で使用。
PHPで使用するための特定の年、月、日の毎日のアーカイブのURLを返します。 これは、URLが表示されません。年、月、日のパラメータが''に設定されている場合、タグは現在の日のアーカイブのURLを返します。
使い方
<?php get_day_link( $year, $month, $day ); ?>
パラメータ
- year
- (ブーリアン/整数) (必須) 年を指定。今年を設定するには''を使用します。
- 初期値: なし
- month
- (ブーリアン/整数) (必須) 月を指定。今月を設定するには''を使用します。
- 初期値: なし
- day
- (ブーリアン/整数) (必須) 日を指定。 今日を設定するには''を使用します。
- 初期値: なし
戻り値
- (string)
- 日のアーカイブのURL
例
現在の日付のリンク
PHPのechoコマンドを使用して現在の日のアーカイブへのURLを返し、Aタグのリンクとして表示します。
<a href="<?php echo get_day_link('', '', ''); ?>">今日の投稿</a>
変数での使用
PHP code block for use within The Loop: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command.
See 日付と時刻の書式 for info on format strings used in get_the_time() tag.
<?php $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $archive_day = get_the_time('d'); ?> <a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>">This day's posts</a>
更新履歴
新規導入: 1.0.0
ソースファイル
get_day_link() は wp-includes/link-template.php
にあります。
関連項目
日時に関連するタグ: get_calendar(), get_day_link(), get_month_link(), get_the_date(), get_the_time(), get_year_link(), single_month_title(), the_date(), the_date_xml(), the_modified_date(), get_the_modified_date(), the_modified_time(), get_the_modified_time(), the_time()
このページ「テンプレートタグ/get day link」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
最新英語版: WordPress Codex » Function_Reference/get_day_link (最新版との差分)