Taxonomy, Terms, and Template Files

These types of URLs are supported since WP 3.1:

register_taxonomy( 'types', 'post', array(
  'hierarchical' => true,
  'rewrite' => array( 'hierarchical' => true ),
  ...
);

Remember to flush the rewrite rules after making the change.

The template you would use for both parent and child terms is taxonomy-types.php:

$current_term = get_queried_object();

if ( 0 == $current_term->parent ) {
  // it's a parent term; display it's child terms using wp_list_categories() etc.
} else {
  // it's a child term; display the posts using The Loop etc.
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)