WordPress文章添加锚标签:permalink_anchor

文 / @WordPress主题

WordPress模板标签permalink_anchor输出一个ID为post-ID的空链接,通常用于跳转页面到特定位置,需要用在The Loop主循环中。

permalink_anchor( string $mode = 'id' )

函数参数

$mode

字符串值,默认值:id

可选的值:

  • id:空链接的ID值为post-ID,其中ID为文章的ID
  • title:空链接的ID值为文章别名

函数使用示例

<h3><?php permalink_anchor(); ?><?php the_title(); ?></h3>

扩展阅读

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

相关函数:

  • get_permalink()
  • the_permalink()
  • post_permalink()
  • permalink_single_rss()
添加UTHEME为好友
扫码添加UTHEME微信为好友
· 分享WordPress相关技术文章,主题上新与优惠动态早知道。
· 微信端最大WordPress社群,限时免费入群。