Created
December 9, 2014 16:17
-
-
Save DanielSantoro/4092c289bbb474c19276 to your computer and use it in GitHub Desktop.
Taxonomy to add Tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Register Custom Taxonomy | |
| function custom_taxonomy() { | |
| $labels = array( | |
| 'name' => _x( 'Tags', 'Taxonomy General Name', 'text_domain' ), | |
| 'singular_name' => _x( 'Tag', 'Taxonomy Singular Name', 'text_domain' ), | |
| 'menu_name' => __( 'Tags', 'text_domain' ), | |
| 'all_items' => __( 'All Tags', 'text_domain' ), | |
| 'parent_item' => __( 'Parent Tags', 'text_domain' ), | |
| 'parent_item_colon' => __( 'Parent Tag:', 'text_domain' ), | |
| 'new_item_name' => __( 'New Tag Name', 'text_domain' ), | |
| 'add_new_item' => __( 'Add New Tag', 'text_domain' ), | |
| 'edit_item' => __( 'Edit Tag', 'text_domain' ), | |
| 'update_item' => __( 'Update Tag', 'text_domain' ), | |
| 'separate_items_with_commas' => __( 'Separate tags with commas', 'text_domain' ), | |
| 'search_items' => __( 'Search tags', 'text_domain' ), | |
| 'add_or_remove_items' => __( 'Add or Remove tags', 'text_domain' ), | |
| 'choose_from_most_used' => __( 'Choose from Most Used tags', 'text_domain' ), | |
| 'not_found' => __( 'Not Found', 'text_domain' ), | |
| ); | |
| $args = array( | |
| 'labels' => $labels, | |
| 'hierarchical' => false, | |
| 'public' => true, | |
| 'show_ui' => true, | |
| 'show_admin_column' => true, | |
| 'show_in_nav_menus' => true, | |
| 'show_tagcloud' => true, | |
| ); | |
| register_taxonomy( 'tags', array( 'post' ), $args ); | |
| } | |
| // Hook into the 'init' action | |
| add_action( 'init', 'custom_taxonomy', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment