WordPress:Template Tags/the permalink

来自站长百科
Xxf3325讨论 | 贡献2008年6月27日 (五) 10:52的版本 (新页面: == Description == Displays the URL for the permalink to the post currently being processed in WordPress:The Loop. ...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

Description

Displays the URL for the permalink to the post currently being processed in WordPress:The Loop. This tag must be within WordPress: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 display the permalink for a post, given its unique post id.

Usage

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

Examples

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(); ?>"><?php the_title(); ?></a>

Parameters

This tag has no parameters.

Related

To generate the permalink for a single, specific post, see get_permalink.

模板:Tag Permalink Tags

模板:No Param Tag Footer