wordpress文章链接:the_permalink()和get_permalink()详解

wordpress中能够调用某篇文章的链接的方法有:the_permalink和get_permalink

 

the_permalink() 显示当前文章或页面的链接

get_permalink() 返回当前文章或页面的链接

 

the_permalink() 函数的代码位于 wp-includes/link-template.php.

 

the_permalink(),获取并显示文章的永久链接(固定链接,不是指短链接),实际上相当于echo get_permalink(),在使用时像其他的wordpress函数一样可以用某篇文章的ID作为参数,以获取该文章的链接。

比较:the_permalink和get_permalink方法适合模板制作,随着后台固定链接形式的变化而变化。

我想说两句

如果你想在评论中显示自定义头像, 请点击 gravatar! *

专业提供WordPress网站建设、主题定制、插件开发和维护优化等服务

New to site? Create an Account


Login

Lost password? ×

Already have an account? Login


Signup

×

Forgot Password

×
Scroll Up