タグ一覧リスト/tag.php

タグ一覧リスト(記事数順に表示&記事数を表示)

<ul>
<?php
    $args = array(
        'orderby' => 'count',
        'order' => 'desc',
        'number' => 10
    );
    $tag_list = get_terms('post_tag', $args);
    foreach( $tag_list as $tag ) {
        echo '<li><a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . ' (' . $tag->count . ')</a></li>';
    }
?>
</ul>

tag.php

<h1><?php single_tag_title(); ?></h1>

補足

	  	<?php
		$args = array(
			'orderby' => 'count', // st-kanaなら「あいうえお順」になるらしい?
			'order' => 'desc',
			'number' => 200
		);
	  	$tag_list = get_terms('post_tag', $args);
	  	foreach ($tag_list as $term) {
	  		$u = (get_term_link( $term, 'post_tag' ));
	  		echo "<li><a href='" . $u . "'>" . $term->name . " (" . $term->count . ")</a></li>";
	  	}
	  	?>