get_the_tags()函數(shù)用于獲取標(biāo)簽信息,包括標(biāo)簽ID、別名、名稱(chēng)、描述等。get_the_tags()函數(shù)需要用在The Loop主循環(huán)中,如果在主循環(huán)之外使用,需要傳遞文章ID。
語(yǔ)法
get_the_tags( int $id = 0 )
參數(shù)
實(shí)例
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo '標(biāo)簽ID:' . $tag->term_id;
echo '<br />標(biāo)簽名稱(chēng):' . $tag->name;
echo '<br />標(biāo)簽描述:' . $tag->description;
}
}
?>