List a custom taxonomy's terms, with links, on the taxonomy page
-
I have registered a custom post type in my functions.php file for “Wines”, with this code:
function customposttype_wines() { $labels = array( 'name' => 'Wines', 'singular_name' => 'Wine', 'menu_name' => 'Wines', 'parent_item_colon' => 'Parent Wine', 'all_items' => 'All Wines', 'view_item' => 'View Wine', 'add_new_item' => 'Add New Wine', 'add_new' => '+', 'edit_item' => 'Edit Wine', 'update_item' => 'Update Wine', 'search_items' => 'Search Wines', 'not_found' => 'No Wines found', 'not_found_in_trash' => 'No Wines found in Trash', ); $args = array( 'label' => 'wines', 'description' => 'Wine Reviews', 'labels' => $labels, 'supports' => array( 'title', ), 'unset' => array ('date'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', ); register_post_type( 'wines', $args ); } add_action( 'init', 'customposttype_wines', 0 );
And registered 9 custom taxonomies (brand, region, grape, etc.) with this code (repeated 9 times with only the <XXX> changing for each):
function customtaxonomy_<XXX> () { $labels = array( 'name' => '<XXX>', 'singular_name' => '<XXX>', 'menu_name' => '<XXX>s', 'all_items' => 'All <XXX>s', 'parent_item' => 'Parent <XXX>', 'parent_item_colon' => 'Parent <XXX>:', 'new_item_name' => 'New <XXX> Name', 'add_new_item' => 'Add New <XXX>', 'edit_item' => 'Edit <XXX>', 'update_item' => 'Update <XXX>', 'separate_items_with_commas' => 'Separate <XXX>s w/commas', 'search_items' => 'Search <XXX>s', 'add_or_remove_items' => 'Add or Remove <XXX>s', 'choose_from_most_used' => 'Choose from the most used <XXX>s', ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'query_var' => true, ); register_taxonomy( '<XXX>s', 'wines', $args ); } add_action( 'init', 'customtaxonomy_<XXX>', 0 );
Now I am trying to display the lists of custom taxonomy terms on the parent page of each, so when visiting https://www.mywebsite.com/wines/<XXX> there is a list, with links, to all the terms that have been entered.
Right now when I visit https://www.mywebsite.com/wines/<XXX> I just see the 404.php error page. But if I visit a taxonomy term page I see the posts within there fine, ie: https://www.mywebsite.com/wines/<XXX>/term
I tried using a taxonomy template hierarchy page, taxonomy-<XXX>.php but it will not load, still just shows the 404.php.
Pulling hair here, any help is very appreciated.
- The topic ‘List a custom taxonomy's terms, with links, on the taxonomy page’ is closed to new replies.