Custom Taxonomy Archive Page

This is useful if you’d like to customize the look of your registered taxonomy archive pages in WordPress.  You can use the options I’ve provided, or find more in the WordPress Codex.  I’ve used this on my snippet-type archive pages (the ones that list all snippets only in a certain category).

Place the following just under get_header(); at top of a template file.  This initializes the loop to only include taxonomy terms.

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

This formats a list of all categories under the taxonomy ‘snippet-type’.

  //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)

    $taxonomy     = 'snippet-type';
    $orderby      = 'name'; 
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 0;      // 1 for yes, 0 for no
    $title        = '';

	$args = array(
	    'taxonomy'     => $taxonomy,
	    'orderby'      => $orderby,
	    'show_count'   => $show_count,
	    'pad_counts'   => $pad_counts,
	    'hierarchical' => $hierarchical,
	    'title_li'     => $title

Include the following line wherever you’d like to display the list of all posts in a certain category.  Anywhere on the page, as long as all the other stuff has been called first.

<?php wp_list_categories( $args ); ?>


Dave Winter focuses in WordPress UI Design and WordPress Plugin Development (some have labelled him a fanatic) but has hands in many other projects, including photography and music. He's never far from a computer... or an iPad (for testing purposes, of course). If you've been to a WordCamp in Southern California, he probably already knows who you are (or maybe not - he's terrible with names). Dave currently teaches courses at California State University, Long Beach alongside his small business at (and his students think he's pretty boss).
© 2008-2020,