任何帮助将不胜感激。 谢谢
使用Get_tags
获取所有帖子标签
<?php
$tags = get_tags(array(
'hide_empty' => false
));
echo '<ul>';
foreach ($tags as $tag) {
echo '<li>' . $tag->name . '</li>';
}
echo '</ul>';
?>
<?php
$tags = get_tags(array(
'smallest' => 10,
'largest' => 22,
'unit' => 'px',
'number' => 10,
'format' => 'flat',
'separator' => " ",
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'echo' => false
));
echo '<ul class="AddYourClassUl">';
foreach ($tags as $tag) {
echo '<li class="AddYourClassLi">' . $tag->name . '</li>';
}
echo '</ul>';
?>
<?php if( has_tag() ) : ?>
<?php echo get_the_tag_list(); // Display tags as links ?>
<?php endif; ?>
<?php if( has_tag() ) : ?>
<?php endif; ?>
我正在使用以下代码。 在第一个加载WordPress上,我的代码将计算Hello WorldPost
$tags = get_tags(array(
'hide_empty' => false // Those tags has no post
));
foreach ($tags as $tag) {
$tag_link = get_tag_link( $tag->term_id );
printf('<a href="%s" title="%s" class="%s">%s</a>',esc_url($tag_link),esc_attr($tag->name),esc_attr($tag->slug),esc_html($tag->name));
}