Monday, January 23, 2017

Register Taxonomy for Custom Post Type

//Register Taxonomy for Product Post Type
add_action( 'init', 'product_taxonomies', 0 );
function product_taxonomies() {
    register_taxonomy(
        'reviews_category',
        'reviews',
        array(
            'labels' => array(
                'name' => 'Product Category',
                'add_new_item' => 'Add Product Category',
                'new_item_name' => "New Product Category"
            ),
            'show_ui' => true,
            'show_tagcloud' => false,
            'hierarchical' => true
        )
    );
}
Display Taxonomy
    <ul class="clearfix"> <?php echo get_the_term_list( $post->ID, 'product_category', '<li class="">', ', ', '</li>' ) ?> </ul>