I have a site that I'm making for a quarterly print magazine. I'm making all of the articles from all issues into Wordpress posts.
Every Article/Post belongs to an Issue and every Issue belongs to a Volume (Standard magazine stuff).
Instead of using Categories to represent a hierarchical relationship between Volume --> Issue I thought it would be better to use a Custom Taxonomy.
So I made a Custom Taxonomy of "Volume".
This is how I registered it in functions.php
function add_custom_taxonomies() {
// Add new "Locations" taxonomy to Posts
register_taxonomy('volume', 'post', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Volumes', 'taxonomy general name' ),
'singular_name' => _x( 'Volume', 'taxonomy singular name' ),
'search_items' => __( 'Search Issues' ),
'all_items' => __( 'All Issues' ),
'parent_item' => __( 'Parent Volume' ),
'parent_item_colon' => __( 'Parent Volume:' ),
'edit_item' => __( 'Edit Volume' ),
'update_item' => __( 'Update Volume' ),
'add_new_item' => __( 'Add New Volume' ),
'new_item_name' => __( 'New Volume Name' ),
'menu_name' => __( 'Volume-Issue' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'volume', // This controls the base slug that will display before each term
'with_front' => true, // Don't display the category base before "/volume/"
'hierarchical' => true // "
),
));
} add_action( 'init', 'add_custom_taxonomies', 0 );
The issue is now that the slug for Taxonomies need to be unique so instead of the urls being very pretty like:
example.com/volume/volume1/issue-2/
i get
example.com/volume/volume-11/issue-1-volume-11/
This seems to be because the slugs "issue-1", "issue-2", "issue-3" and "issue-4" were taken up in the first volume and slugs need to be unique?
It's not the worst problem in the world but I though that since the Taxonomy for Issue is under a Volume which is unique I wouldn't have this problem. However, I do....
Anyway, can anyone suggest a better way to do this? Custom post Types possibly? Though I thought this was the perfect answer, just can't seem to get the URL's and slugs to cooperate.
I'd like to just come out with very pretty and predictable URLS like:
example.com/volume-1/issue-1/ example.com/volume-1/issue-2/ example.com/volume-9/issue-3/
I'd really appreciate the communities insight on this.
Thanks
Mike