I've looked at several posts on here trying to crack this. I think it's simple for someone who knows more. The details:
Theme: Custom theme built on Roots starter
WP: 3.8.1
Custom Post Type: pre_owned_cars
My custom post types work well - I'm used to doing those. The taxonomy however is tripping me up. I have it working with the code in my functions.php file, but I can't figure out how to display a taxonomy. I've created taxonomy.php and updated permalinks.
Here's my functions.php code for the taxonomy - I'm trying to name the taxonomy "type":
// add tags to pages
add_action( 'init', 'register_taxonomy_types' );
function register_taxonomy_types() {
$labels = array(
'name' => _x( 'Types', 'types' ),
'singular_name' => _x( 'Type', 'types' ),
'search_items' => _x( 'Search Types', 'types' ),
'popular_items' => _x( 'Popular Types', 'types' ),
'all_items' => _x( 'All Types', 'types' ),
'parent_item' => _x( 'Parent Type', 'types' ),
'parent_item_colon' => _x( 'Parent Type:', 'types' ),
'edit_item' => _x( 'Edit Type', 'types' ),
'update_item' => _x( 'Update Type', 'types' ),
'add_new_item' => _x( 'Add New Type', 'types' ),
'new_item_name' => _x( 'New Type', 'types' ),
'separate_items_with_commas' => _x( 'Separate types with commas', 'types' ),
'add_or_remove_items' => _x( 'Add or remove Types', 'types' ),
'choose_from_most_used' => _x( 'Choose from most used Types', 'types' ),
'menu_name' => _x( 'Types', 'types' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => true,
'show_admin_column' => false,
'hierarchical' => true,
'rewrite' => array(
'slug' => 'used-cars',
'with_front' => true,
'hierarchical' => true
),
'query_var' => true
);
register_taxonomy( 'types', array('pre-owned-cars'), $args );
}
Any help GREATLY appreciated!
types
, and given it the slugused-cars
, so a single term will be/used-cars/term-name/
. have you created a term and assign it to a post? note that taxonomies aren't like post types- there is no single archive, it's archives for each term.