get_page_link

Sponsored Link

最初の引数として渡された場合、現在のページ(ループ内の場合)または任意のページIDのパーマリンクを取得します。全ての引数はオプションです。全ての引数のデフォルトはfalseです。

Sponsored Link

$idが渡された場合、リンクが返されるページのIDになります。

$leavenameは、パーマリンク内に”%pagename%”外に切り替えをオフに切り替えるために使用することができます。

$sampleは、サンプルパーマリンクを返します。

Retrieves the permalink for the current page (if in The Loop) or any arbitrary page ID if passed as the first argument. All arguments are optional. All arguments default to false.

If $id is passed, it will be the id of the page whose link is returned.

$leavename can be used to toggle off the switching out of “%pagename%” in permalinks.

$sample returns a sample permalink.

get_page_linkのテンプレートタグ使用方法

<?php get_page_link($id, $leavename, $sample); ?>

get_page_linkのパラメーター

$id

(mixed) (optional)ページID。
デフォルト:false

(mixed) (optional) Page ID
Default: false

$leavename

(bool) (optional)ページ名を保持するかどうか。
デフォルト:false

(bool) (optional) Whether to keep page name
Default: false

$sample

(bool) (optional) サンプルパーマリンクですか?
デフォルト:false

(bool) (optional) Is it a sample permalink?
Default: false

戻り値

(string)パーマリンクを含む文字列です。

(string) A string containing the permalink.

この例では、ID番号40を持つページに”Map”名付けられたリンクを表示するでしょう。

This example will display a link named “Map”, to page with id number 40.

<a href="<?php echo get_page_link(40); ?>">Map</a>
Sponsored Link