• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「テンプレートタグ/the permalink」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(1 版)
6行目: 6行目:
 
* 出力例: <code><nowiki><p><a href="http://example.com/index.php?p=1">この記事のパーマリンク</a></p></nowiki></code>
 
* 出力例: <code><nowiki><p><a href="http://example.com/index.php?p=1">この記事のパーマリンク</a></p></nowiki></code>
  
[[en:Template Tags/the_permalink]]
+
== 説明 ==
 +
 
 +
Displays the [[Glossary#URI and URL|URL]] for the [[Glossary#Permalink|permalink]] to the post currently being processed in [[The Loop]]. This tag must be within [[The Loop]], and is generally used to display the permalink for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalink for the post that is being processed, you cannot use it to display the permalink to an arbitrary post on your weblog. Refer to [[Template_Tags/get_permalink|get_permalink()]] if you want to get the permalink for a post, given its unique post id.
 +
 
 +
== 使い方 ==
 +
 
 +
%%% <?php the_permalink(); ?> %%%
 +
 
 +
== 引数 ==
 +
 
 +
This tag has no parameters.
 +
 
 +
== 用例 ==
 +
 
 +
=== Display Post URL as Text ===
 +
 
 +
Displays the URL to the post, without creating a link:
 +
 
 +
This address for this post is: &lt;?php the_permalink(); ?&gt;
 +
 
 +
=== As Link With Text ===
 +
 
 +
You can use whatever text you like as the link text, in this case, "permalink".
 +
 
 +
&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;permalink&lt;/a&gt;
 +
 
 +
=== Used as Link With Title Tag===
 +
 
 +
Creates a link for the permalink, with the post's title as the link text. This is a common way to put the post's title.
 +
 
 +
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
 +
 
 +
== 変更履歴 ==
 +
 
 +
* Since: [[Version 1.2|1.2.0]]
 +
* Originally defined in {{Trac|wp-includes/template-functions-links.php|tags/1.5|3}}
 +
* File renamed to {{Trac|wp-includes/link-template.php|tags/2.1|4}} in [[Version 2.1|2.1]]
 +
 
 +
== ソースコード ==
 +
 
 +
<tt>the_permalink()</tt> is located in {{Trac|wp-includes/link-template.php}}.
 +
 
 +
== 関連項目 ==
 +
 
 +
{{Permalink Tags}}
 +
 
 +
{{原文|Function Reference/the permalink|140477}}<!-- 22:59, 9 January 2013 Outis 版 -->
 +
 
 +
{{Tag Footer}}

2014年5月17日 (土) 15:22時点における版

  • 書式: <?php the_permalink(); ?>
  • 説明: 記事のパーマリンクを出力。
  • 位置: ループ内
  • 引数: なし
  • コード記述例: <p><a href="<?php the_permalink(); ?>">この記事のパーマリンク</a></p>
  • 出力例: <p><a href="http://example.com/index.php?p=1">この記事のパーマリンク</a></p>

説明

Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is generally used to display the permalink for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalink for the post that is being processed, you cannot use it to display the permalink to an arbitrary post on your weblog. Refer to get_permalink() if you want to get the permalink for a post, given its unique post id.

使い方

%%% <?php the_permalink(); ?> %%%

引数

This tag has no parameters.

用例

Display Post URL as Text

Displays the URL to the post, without creating a link:

This address for this post is: <?php the_permalink(); ?>

As Link With Text

You can use whatever text you like as the link text, in this case, "permalink".

<a href="<?php the_permalink(); ?>">permalink</a>

Used as Link With Title Tag

Creates a link for the permalink, with the post's title as the link text. This is a common way to put the post's title.

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>

変更履歴

ソースコード

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最新版との差分


関数リファレンステンプレートタグ目次もご覧ください。