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

WordPress获取当前文章Tag列表标签:get_the_tag_list

时间:2024-03-15

WordPress模板标签get_the_tag_list用于获取当前标签列表,需要用在The Loop主循环中,如果在主循环之外使用,需要传递文章ID。

get_the_tag_list( string $before = '', string $sep = '', string $after = '', integer $id = 0 )

函数参数

$before

字符串值,默认为空

在链接前输出

$sep

字符串值,默认为空

在链接之间输出,用于分隔多个标签

$after

字符串值,默认为空

在链接后输出

$id

整数型,默认值:当前文章ID

指定一个文章ID,用于输出该文章的标签

函数使用示例

<?php echo get_the_tag_list('<p>标签: ', ', ', '</p>'); ?>

扩展阅读

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

相关函数:

  • get_tag()

  • get_tag_link()

  • get_tags()

  • get_the_tags()

  • is_tag()

  • the_tags()

  • single_tag_title()

  • tag_description()

  • wp_generate_tag_cloud()

  • wp_tag_cloud()


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

Copyright © 2019-2024 baidu.bond


Whatsapp
Powered by RRZCMS