Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code to register a projects and projects groups taxonomy.
<?php
function akv3_register_projects_tax() {
register_taxonomy(
'projects',
array('post'),
array(
'hierarchical' => true,
'labels' => array(
'name' => __('Projects', 'projects'),
'singular_name' => __('Project', 'projects'),
'search_items' => __('Search Projects', 'projects'),
'popular_items' => __('Popular Projects', 'projects'),
'all_items' => __('All Projects', 'projects'),
'parent_item' => __('Parent Project', 'projects'),
'parent_item_colon' => __('Parent Project:', 'projects'),
'edit_item' => __('Edit Project', 'projects'),
'update_item' => __('Update Project', 'projects'),
'add_new_item' => __('Add New Project', 'projects'),
'new_item_name' => __('New Project Name', 'projects'),
),
'sort' => true,
'args' => array('orderby' => 'term_order'),
'public' => false,
'show_ui' => true,
)
);
register_taxonomy(
'project-groups',
array('project'),
array(
'hierarchical' => true,
'labels' => array(
'name' => __('Project Groups', 'projects'),
'singular_name' => __('Project Group', 'projects'),
'search_items' => __('Search Project Groups', 'projects'),
'popular_items' => __('Popular Project Groups', 'projects'),
'all_items' => __('All Project Groups', 'projects'),
'parent_item' => __('Parent Project Group', 'projects'),
'parent_item_colon' => __('Parent Project Group:', 'projects'),
'edit_item' => __('Edit Project Group', 'projects'),
'update_item' => __('Update Project Group', 'projects'),
'add_new_item' => __('Add New Project Group', 'projects'),
'new_item_name' => __('New Project Group Name', 'projects'),
),
'sort' => true,
'args' => array('orderby' => 'term_order'),
'public' => false,
'show_ui' => true,
)
);
}
add_action('init', 'akv3_register_projects_tax', 999);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.