通過以下的代碼來調(diào)用,可以實(shí)現(xiàn)WordPress熱門標(biāo)簽顯示文章數(shù)量等自定義功能,下面的代碼中顯示了標(biāo)簽的文章數(shù)量,以及可以自定義標(biāo)簽前后的代碼樣式。
<?php
$tags_list = get_tags( array('number' => '666', 'orderby' => '', 'order' => 'DESC', 'hide_empty' => false) );
shuffle($tags_list);
$count=0;
if ($tags_list) {
foreach($tags_list as $tag) {
$count++;
echo '<a title="' . $tag->count . '個(gè)" href="'.get_tag_link($tag->term_id).'" target="_blank">'.$tag->name.'</a>';
if( $count >30 ) break;
}
}
?>