get_permalink – WordPress*リファレンス
PHPでの使用のためにpermalinkをポストに返します。 それは、permalinkを表示しないで、Loopの外で使用することができます。
⇒Returns the permalink to a post for use in PHP. It does NOT display the permalink and can be used outside of The Loop.
タグ使用方法
<?php get_permalink(id); ?>
Default Usage
現在のポスト(Loopの中で使用される)のためのpermalink。 タグがpermalinkを表示しないとき、例はPHPエコーコマンドを使用します。
⇒The permalink for current post (used within The Loop). As the tag does not display the permalink, the example uses the PHP echo command.
Permalink for this post: <?php echo get_permalink(); ?>
Link to Specific Post
ハイパーテキストリンクとして情報のリストの中で2つの特定のポスト(ポストID1と10)のpermalinksを返します。 同じくらい上では、タグが、permalinkを表示するのにPHPエコーコマンドを使用します。
⇒Returns the permalinks of two specific posts (post IDs 1 and 10) as hypertext links within an informational list. As above, tag uses the PHP echo command to display the permalink.
<ul>
<li>MyBlog info:
<ul>
<li><a href="<?php echo get_permalink(1); ?>">About MyBlog</a></li>
<li><a href="<?php echo get_permalink(10); ?>">About the owner</a></li>
</ul>
</li>
</ul>
例
ポストのタイトルの横のpermalinkアンカーを挿入します。
⇒Inserts the permalink anchor next to a post’s title.
<h3><?php permalink_anchor(); ?><?php the_title(); ?></h3>
Parameters
id
(integer) ポストのための数値ID。 このタグがLoopでイドパラメタ価値なしで使用されるとき、デフォルトに現在のポストIDにタグ付けをしてください。
⇒The numeric ID for a post. When this tag is used in The Loop without an id parameter value, tag defaults to the current post ID.
使用例
関連テンプレートタグ
permalink_anchor,get_permalink,the_permalink,permalink_single_rss
関連記事







