您的当前位置:首页 > 知识博客 > wordpress建站

WordPress输出文章固定链接标签:the_permalink

时间:2024-03-15

WordPress模板标签the_permalink用于输出文章的固定链接,即伪静态形式的链接地址,需要用在The Loop主循环中。

the_permalink( $post = 0 )

该函数没有参数,事实上the_permalink()函数相当于调用了get_permalink( $post ),将当前文章对象传递给了get_permalink()函数并输出返回的结果。

函数使用示例

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

扩展阅读

the_permalink()函数位于:wp-includes/link-template.php

相关函数:

  • permalink_anchor()

  • get_permalink()

  • post_permalink()

  • permalink_single_rss()


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 wangzhan.shop


Whatsapp
Powered by RRZCMS