I'm using the cherry framework on a WP site. It comes with a custom post type that can be used to add 'Team Members' and create staff pages etc.
I need to expand this so that I can add tags to each 'team member' inorder that I can essentially tag them as working in a department a / b / c / etc.
The custom post type is registered in the theme-init.php file using this code;
/* Our Team */
function my_post_type_team() {
register_post_type( 'team',
array(
'label' => theme_locals("our_team"),
'singular_label' => theme_locals("our_team"),
'_builtin' => false,
// 'exclude_from_search' => true, // Exclude from Search Results
'capability_type' => 'page',
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'menu_position' => 5,
'menu_icon' => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-businessman' : '',
'rewrite' => array(
'slug' => 'team-view',
'with_front' => FALSE,
),
'supports' => array(
'title',
'editor',
'thumbnail',
)
)
);
}
add_action('init', 'my_post_type_team');
I want to add tags to this, so that when I add a new team member, I can also assign them to a department by means of adding a given relevant tag. At present the tag editor box doesn't appear on the add new / edit page.
So, I adapted the above code to include a register taxonomy like this;
/* Our Team */
function my_post_type_team() {
register_post_type( 'team',
array(
'label' => theme_locals("our_team"),
'singular_label' => theme_locals("our_team"),
'_builtin' => false,
// 'exclude_from_search' => true, // Exclude from Search Results
'capability_type' => 'page',
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'menu_position' => 5,
'menu_icon' => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-businessman' : '',
'rewrite' => array(
'slug' => 'team-view',
'with_front' => FALSE,
),
'supports' => array(
'title',
'editor',
'thumbnail',
)
)
);
register_taxonomy(
'team_tag',
'team',
array(
'hierarchical' => false,
'label' => theme_locals("tags"),
'singular_name' => theme_locals("tag"),
'rewrite' => true,
'query_var' => true
)
);
}
add_action('init', 'my_post_type_team');
However, I'm still not getting the tag box showing up on the edit page in admin.
Any help with this will be greatly appreciated.
theme_locals