I have a taxonomy register with name doctor-services and I have a taxonomy template with name taxonomy-doctor-services.php but when I click on taxonomy link it does not display detail of the taxonomy. Here is a code
function doctors_custom_post(){
$labels = array(
'name' => 'Doctors',
'singular_name' => 'Doctor',
'add_new' => 'Add Doctor',
'add_new_item' => 'Add New Doctor',
'all_items' => 'All Doctors',
'edit_item' => 'Edit Item',
'new_item' => 'New Item',
'view_item' => 'View Item',
'search_items' => 'Search Doctors',
'not_found' => 'No record found',
'not_found_in_trash' => 'No items found in trash',
'parent_item_colon' => 'Parent Item'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revisions'),
//'taxonomies' => array('category', 'post_tags'),
'menu_position' => 15,
'exclude_from_search' => false
);
register_post_type('my-doctor', $args);
}
add_action('init', 'doctors_custom_post');
add_action( 'init', 'doctors_my_taxonomy');
function doctors_my_taxonomy(){
// custom post type taxonomies
$labels = array(
'name' => 'Doctor Departments',
'singular_name' => 'Doctor Department',
'add_new' => 'Add Department',
'add_new_item' => 'Add New Department',
'all_items' => 'All Departments',
'edit_item' => 'Edit Item',
'new_item' => 'New Item',
'view_item' => 'View Item',
'update_item' => 'Update Department',
'search_items' => 'Search Departments',
'not_found' => 'No record found',
'not_found_in_trash' => 'No items found in trash',
'parent_item_colon' => 'Parent Item',
'menu_name' => 'Departments'
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'doctor_departments'),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
);
register_taxonomy('doctor-department', array('my-doctor'), $args);
$labels = array(
'name' => 'Diseases',
'singular_name' => 'Diseases',
'add_new' => 'Add Disease',
'add_new_item' => 'Add New Disease',
'all_items' => 'All Disease',
'edit_item' => 'Edit Item',
'new_item' => 'New Item',
'view_item' => 'View Item',
'update_item' => 'Update Disease',
'search_items' => 'Search Disease',
'not_found' => 'No record found',
'not_found_in_trash' => 'No items found in trash',
'parent_item_colon' => 'Parent Item',
'menu_name' => 'Diseases'
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'doctor_diseases'),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
);
register_taxonomy('doctor-diseases', array('my-doctor'), $args);
$labels = array(
'name' => 'Services',
'singular_name' => 'Service',
'add_new' => 'Add Service',
'add_new_item' => 'Add New Service',
'all_items' => 'All Services',
'edit_item' => 'Edit Item',
'new_item' => 'New Item',
'view_item' => 'View Item',
'update_item' => 'Update Service',
'search_items' => 'Search Service',
'not_found' => 'No record found',
'not_found_in_trash' => 'No items found in trash',
'parent_item_colon' => 'Parent Item',
'menu_name' => 'Services'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'hierarchical' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'doctor_services'),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
);
register_taxonomy('doctor-services', array('my-doctor'), $args);
}
and taxonomy Services page
<?php
get_header(); ?>
<div id="primary">
<div id="content" class="content">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-9 col-lg-9">
<h2> <?php
single_cat_title();
?>
</h2>
<?php category_description(); ?>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
and taxonomy link when I clicked
http://example.com/doctor_services/xray/
Please help where is the error
Goto > settings >permalinks->select (post name) > save changes
this will refresh your permalinks structure.permalinks
dont change anything justsave changes