有人能告诉我如何在这个代码段中显示post计数吗?
<?php $tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo \'<li><a href="\' . get_tag_link( $tag->term_id ) . \'" title="\' . sprintf( __( "View all posts in %s" ), $tag->name ) . \'" \' . \'>\' . $tag->name.\'</a> </li> \';
}
};?>
最合适的回答,由SO网友:Michael 整理而成
具体在哪里?下面的示例是在链接外部标记名后的括号中显示的计数:
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo \'<li><a href="\' . get_tag_link( $tag->term_id ) . \'" title="\' . sprintf( __( "View all posts in %s" ), $tag->name ) . \'" \' . \'>\' . $tag->name.\'</a> (\'.$tag->count.\') </li> \';
}
};
?>
http://codex.wordpress.org/Function_Reference/get_tags