I have created a custom post type "Events" and added the categories function for it. However, the categories only shows in the backend CMS which I can set and add new categories, but no message indicating the category that a event was set for in the front end webpage.
How can I make the events categories information shown in the front end webpage?
I have copied the code below:
function enable_event_posttype() {
register_post_type( 'events',
array(
'labels' => array(
'name' => __( 'Events' ),
'singular_name' => __( 'Event' ),
'add_new' => __( 'Add New Event' ),
'add_new_item' => __( 'Add New Event' ),
'edit_item' => __( 'Edit Event' ),
'new_item' => __( 'Add New Event' ),
'view_item' => __( 'View Event' ),
'search_items' => __( 'Search Event' ),
'not_found' => __( 'No events found' ),
'not_found_in_trash' => __( 'No events found in trash' )
),
'public' => true,
'supports' => array( 'title', 'editor', 'comments'),
'capability_type' => 'post',
'rewrite' => array("slug" => "events"), // Permalinks format
'menu_icon' => get_bloginfo('stylesheet_directory') . '/images/date.png', // Icon Path
'menu_position' => '5'
)
);
}
add_action( 'init', 'enable_event_posttype' );
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
register_taxonomy( 'categories', 'events', array( 'hierarchical' => true, 'label' => 'Categories', 'query_var' => true, 'rewrite' => true ) );
}