WordPress固定链接模块——Permalink Template Tags

Permalink Template Tags 中函数的作用是在WordPress主题中生成固定链接,包括Permalink Anchor、 Permalink (PHP) 、Permalink URL 、Permalink(formatted for syndication feeds)。

一. Permalink Anchor——输出带有标识符的文章链接

语法:<?php permalink_anchor(‘type’); ?>
参数说明:type[id|title]
id——post ID
tile——postname
输出样式<a id=”….
例:<?php permalink_anchor(‘type=title’); ?>

二. Permalink (PHP)——在php中调用文章permalink

语法:<?php get_permalink(id); ?>
参数说明:
id——文章ID(post ID),若函数用于循环(loop)内,并且没有指定id时,id默认取值当前文章的post ID。
例:<?php get_permalink(17); ?>

三. Permalink URL——文章固定链接

语法:<?php the_permalink(); ?>
参数说明:无参数,此函数必须用于循环(loop)中,返回正在处理的文章固定链接。

四. Permalink(formatted for syndication feeds)

语法:<?php permalink_single_rss(‘file’); ?>
参数说明:
file——链接指向的页面,默认为当前页。
例:<?php permalink_single_rss(‘index.php’); ?>

除非注明,本博客文章均为原创,转载请以链接形式标明本文地址
原创文章如转载,请注明:转载自 任鸟飞网页设计 [ http://www.renniaofei.com/ ]
本文链接地址: http://www.renniaofei.com/code/wordpress-permalink-template-tags/
引用通告地址 Trackback URL:直接在本文链接地址后添加 trackback/
任鸟飞

任鸟飞网页设计网创办者 主要关注网页设计,网站建设,图形图像设计。 Twitter @renniaofei QQ:29900684

发表评论

电子邮件地址不会被公开。 必填项已被标记为 *

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>