Need a category index page?

Why not just use a normal page?

Oh, sure, you want a dynamically loading list of the categories.

Try this on for size:


add_shortcode( 'taxonomy-list', 'my_taxonomy_list' );
function my_taxonomy_list( $atts ) {
    $args = shortcode_atts( array(
        'taxonomy' => 'category',
        'title_li' => '',
        'depth' => 1,
        'hide_empty' => 1,
    ), $atts );

    ob_start();
    ?>
        <ul class="taxonomy-list taxonomy-<?php echo $args['taxonomy']; ?>-list" data-taxonomy="<?php echo $args['taxonomy']; ?>">
            <?php wp_list_categories( $args ); ?>
        </ul>
    <?php
    return ob_get_clean();
}

Author: George Stephanis

Cooking, Code, Carpentry, Letterpress.