WordPress:Template Tags/the permalink

来自站长百科
跳转至: 导航、​ 搜索

描述[ ]

显示当前正在The Loop中处理的文章的permalinkURL。这个标签必须用于The Loop内部,一般是显示文章的时候,这个标签用来显示每篇文章的permalink。因为这个标签限制为显示正在处理的文章的permalink,你不能使用这个标签来显示网络日志上任意一篇文章的permalink。如果你想要显示某个id数字的文章的permalink,请参考get_permalink()

用法[ ]

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

例子[ ]

将文章URL作为文本显示[ ]

显示文章的URL,没有创建链接:

这篇文章的这个地址是:<?php the_permalink(); ?>

作为带有文本的链接[ ]

你可以使用任何你喜欢的文本作为链接文本,在这个例子中是,"permalink"。

<a href="<?php the_permalink(); ?>">permalink</a>

用作带有标题标签的链接[ ]

为permalink创建一个链接,将文章标题作为链接文本。这是处理文章标题的一种常见的方法。

<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

参数[ ]

这个标签没有参数。

相关的[ ]

要为一篇单一的,特别的文章,创建permalink,请看看get_permalink

模板:标签Permalink标签