WordPress获取文章Tag标签:the_tags

WordPress模板标签the_tags用于在文章页输出标签链接,必须用在The Loop主循环中。

the_tags( string $before = null, string $sep = ', ', string $after = '' )

函数参数

$before

字符串值,默认值:null

在标签链接前显示的文本。

$sep

字符串值,默认值:,

在每个标签链接之间显示的文本。

$after

字符串值,默认为空

在标签链接后显示的文本。

函数使用示例

以无序列表输出标签链接:

<ul>
	<?php the_tags('<li>', '</li><li>', '</li>') ?>
</ul>

扩展阅读

the_tags()函数位于:wp-includes/category-template.php

相关函数:

阿里云