- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/the permalink
提供: WordPress Codex 日本語版
目次
説明
ループ の中で処理されている投稿の パーマリンク の URL を表示します。このタグは ループ 内で使用されなければならず、一般的に各投稿のパーマリンクを表示するときに利用します。このテンプレートタグは処理されている投稿のパーマリンクを表示することに限定されているので、あなたのブログ上の任意の投稿のパーマリンクを表示するために使用することは出来ません。もしもユニークな投稿IDを与えた投稿のパーマリンクを取得したいのなら、 get_permalink() を参照してください。
使い方
<?php the_permalink(); ?>
引数
なし
用例
テキストとして投稿のURLを表示
リンクせずに投稿のURLを表示。
This address for this post is: <?php the_permalink(); ?>
テキストを使ったリンク
リンクテキストとしてあなたが好きな文字列を使用することができます。(この場合は "permalink") You can use whatever text you like as the link text, in this case, "permalink".
<a href="<?php the_permalink(); ?>">permalink</a>
タイトルタグを使ったリンク
投稿のタイトルをリンクテキストとしてパーマリンクを作成します。投稿のタイトルに使う一般的な方法です。
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
変更履歴
- Since: 1.2.0
- Originally defined in
構文エラー: "tags" は認識できません/src/wp-includes/template-functions-links.php wp-includes/template-functions-links.php
- File renamed to
構文エラー: "tags" は認識できません/src/wp-includes/link-template.php wp-includes/link-template.php
in 2.1
ソースコード
the_permalink() is located in wp-includes/link-template.php
.
関連項目
get_permalink(), the_permalink(), post_permalink(), permalink_anchor(), permalink_single_rss()
最新英語版: WordPress Codex » Function Reference/the permalink (最新版との差分)
関数リファレンス、テンプレートタグ目次もご覧ください。