MENU

get permalink

PHPで使用するために投稿のパーマリンクを返します。パーマリンクを表示せず、ループの外で使用することができます。失敗した場合はfalseを返します。

パラメータIDがない投稿のページ(インデックス、アーカイブ、等)でループ外で使用するとき、現在のページのパーマリンクがない、ループ内の最後の記事のURLを返すので注意してください。参照:http://core.trac.wordpress.org/ticket/9963

Returns the permalink to a post for use in PHP. It does NOT display the permalink and can be used outside of The Loop. On failure returns false.

Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, not the permalink for the current page. See: http://core.trac.wordpress.org/ticket/9963

目次

get permalinkのファンクションタグ使用方法

[php] [/php]

get permalinkのパラメーター

$id

(integer) (optional)投稿の数値IDです。
デフォルト:ループで使用されていた時、現在のポストのIDです。

The numeric ID for a post.
Default: The current post ID, when used in The Loop.

デフォルトの使用方法

現在の投稿のためのパーマリンク(ループ内で使用される)です。タグがパーマリンクを表示しないように、例では、PHPのechoコマンドを使用しています。

The permalink for current post (used within The Loop). As the tag does not display the permalink, the example uses the PHP echo command.

[php]この投稿のパーマリンクです:
[/php]

特定の投稿へのリンク

情報リスト内のハイパーテキストリンクとして2つの特定の投稿(記事IDが1と10)のパーマリンクを返します。上記のように、タグにはパーマリンクを表示するためにPHPのechoコマンドを使用しています。

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.

[php] [/php]

現在のページへのリンク

LOOP外で使用することができます。

This can also be used outside the LOOP

[php]
よかったらシェアしてね!
  • URLをコピーしました!

この記事を書いた人

WordPress Love! 休日はほぼWordPress仲間と一緒に勉強会や写真を撮りに行っています。現在育児中のため、オフが多いです(>△<<<)

コメント

コメントする

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

目次