I have three custom post types created already and their landing pages (page-events.php, etc):
Events, Retreats, Coaching
But for the first, I need some sort of categories which I am going to list on the landing page (page-events.php) as a menu, and inside them I would need blog posts.
I have created a custom taxonomy for this Events custom post type:
register_taxonomy("event", array("event"), array("hierarchical" => true, "label" => "Event Type", "singular_label" => "Event Types ", "rewrite" => true));
The custom post type function for Events:
add_action( 'init', 'create_events' );
function create_events() {
$labels = array(
'name' => _x('Events', 'post type general name'),
'singular_name' => _x('Event', 'post type singular name'),
'add new, edit, etc, save space'
'not_found_in_trash' => __('No Events found in Trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor', 'revisions', 'excerpt', 'thumbnail', 'page-attributes');
register_post_type( 'event',
array(
'labels' => $labels,
'public' => true,
'has_archive' => true,
'hierarchical' => true,
'query_var' => true,
'supports' => $supports
)
);
}
Haven't tried adding posts/pages, have just created them, I can add new Event and chose the Event type in a right side box though. But..
Is this the right approach? Will this work for me, is there anything else I can do better so I won't find a hard time to query for posts belonging to a specific taxonomy under this custom post type?
I've never worked with custom post types and taxonomies and is a bit confusing for me, I just want to make sure I get the right approach.
Thanks.