関数リファレンス/get categories
単純に表示するなら、
<?php $args = array( // 'order' => 'ASC', //昇順 // 'orderby' => 'count' //投稿数でソート とかオプション記述 ); $categories = get_categories($args); foreach ($categories as $category) { echo '<a id="cat-' . $category->term_id . '-url" title="' . esc_html($category->cat_name) . 'の投稿一覧へ" href="' . get_category_link($category->term_id) . '" >' . esc_html($category->cat_name) . ' (' . $category->category_count . ')</a>'; } ?>
<?php $categories = get_categories( $args ); ?> <?php $args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false ); ?>