I'm driving myself crazy with the following issue, hope you can help me!
I'm working on a WordPress theme for a business directory so I decided to make some custom posts types on functions.php file like "Surgical", "Non Surgical", etc... Under the custom post type of "surgical" I've created a custom taxonomy called "surgical_cat". Everything is ok until now.
The thing is that I've created some categories under "surgical_cat" called "Arm Lift", "Brachioplasty reduction", “Breast Augmentation” and I made template according to the codex rule: http://codex.wordpress.org/Category_Templates but it didn't work. I have been looking around like crazy and nothing showed up... except 404.php error page/template.
Can someone please let me know how to proceed to make this category based template for my category inside this custom taxonomy? I am really worried about this :( Thank you very much!
To see the site, please visit that link: http://my-portfolio-site.site88.net/business_directory/
You could find the list under the title: Procedures Surgical
CUSTOM POST TYPE REGISTERING FOR 'surgical' on functions.php file:
// CUSTOM POST TYPE REGISTERING FOR 'surgical'
add_action( 'init', 'surgical_post' );
function surgical_post() {
register_post_type( 'surgical',
array(
'labels' => array(
'name' => __( 'Surgical' ),
'singular_name' => __( 'Surgical' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Surgical' ),
'edit_item' => __( 'Edit Surgical' ),
'new_item' => __( 'New Surgical' ),
'view_item' => __( 'View Surgical' ),
'not_found' => __( 'Sorry, we couldn\'t find the Surgical you are looking for.' )
),
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => true,
'menu_position' => 5,
'has_archive' => true,
'hierarchical' => false,
'capability_type' => 'page',
'rewrite' => array( 'slug' => 'surgical' ),
'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail', )
)
);
}
REGISTERING CUSTOM TAXONOMY FOR CUSTOM POST TYPE 'surgical' on functions.php file:
add_action( 'init', 'business_listing_taxonomy');
function business_listing_taxonomy() {
register_taxonomy(
'surgical_cat', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'surgical', //post type name
array(
'public' => true,
'hierarchical' => true,
'label' => 'Surgical Category', //Display name
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => 'surgical', // This controls the base slug that will display before each term
'with_front' => false // Don't display the category base before
)
)
);
}
wp list categories for displaying categories on homepage:
//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
<?php
$args = array(
'post_type' => 'surgical',
'taxonomy' => 'surgical_cat',
'orderby' => 'surgical_order',
'show_count' => 1,
'pad_counts' => 1,
'hierarchical' => 1,
'title_li' => '',
);
?>
<ul>
<?php wp_list_categories( $args ); ?>
</ul>