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


HOME » テンプレートタグ » パーマリンクタグ » get_permalink – WordPress*リファレンス