Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Created June 3, 2013 19:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JiveDig/5700466 to your computer and use it in GitHub Desktop.
Save JiveDig/5700466 to your computer and use it in GitHub Desktop.
Register The "Video Categories" and "Video Tags" Custom Taxonomies
// ------------------------------ Video Categories
if ( ! function_exists('jivedig_video_category_taxonomy') ) {
// Register Custom Taxonomy
function jivedig_video_category_taxonomy() {
$labels = array(
'name' => 'Video Categories',
'singular_name' => 'Video Category',
'menu_name' => 'Video Categories',
'all_items' => 'All Video Categories',
'parent_item' => 'Parent Video Category',
'parent_item_colon' => 'Parent Video Category:',
'new_item_name' => 'New Video Category',
'add_new_item' => 'Add New Video Category',
'edit_item' => 'Edit Video Category',
'update_item' => 'Update Video Category',
'separate_items_with_commas' => 'Separate video categories with commas',
'search_items' => 'Search video categories',
'add_or_remove_items' => 'Add or remove video categories',
'choose_from_most_used' => 'Choose from the most used video categories',
);
$rewrite = array(
'slug' => 'video-categories',
'with_front' => true,
'hierarchical' => true,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => false,
'query_var' => 'video_cat',
'rewrite' => $rewrite,
);
register_taxonomy( 'video_cat', 'videos', $args );
}
// Hook into the 'init' action
add_action( 'init', 'jivedig_video_category_taxonomy', 0 );
}
// ------------------------------ Video Tags
if ( ! function_exists('jivedig_video_tag_taxonomy') ) {
// Register Custom Taxonomy
function jivedig_video_tag_taxonomy() {
$labels = array(
'name' => 'Video Tags',
'singular_name' => 'Video Tag',
'menu_name' => 'Video Tags',
'all_items' => 'All Video Tags',
'parent_item' => 'Parent Video Tag',
'parent_item_colon' => 'Parent Video Tag:',
'new_item_name' => 'New Video Tag',
'add_new_item' => 'Add New Video Tag',
'edit_item' => 'Edit Video Tag',
'update_item' => 'Update Video Tag',
'separate_items_with_commas' => 'Separate video tags with commas',
'search_items' => 'Search video tags',
'add_or_remove_items' => 'Add or remove video tags',
'choose_from_most_used' => 'Choose from the most used video tags',
);
$rewrite = array(
'slug' => 'video-tags',
'with_front' => true,
'hierarchical' => true,
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => false,
'query_var' => 'video_tag',
'rewrite' => $rewrite,
);
register_taxonomy( 'video_tag', 'videos', $args );
}
// Hook into the 'init' action
add_action( 'init', 'jivedig_video_tag_taxonomy', 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment