Created
March 3, 2014 21:34
-
-
Save certainlyakey/9335092 to your computer and use it in GitHub Desktop.
Wordpress - register custom taxonomy for custom post type
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
//Create categories for books | |
function create_booktag_taxonomy() { | |
$labels_booktag = array( | |
'name' => _x( 'Тэги публикаций', 'taxonomy general name' ), | |
'singular_name' => _x( 'Тэг публикаций', 'taxonomy singular name' ), | |
'search_items' => __( 'Искать тэги публикаций' ), | |
'all_items' => __( 'Все тэги публикаций' ), | |
'edit_item' => __( 'Редактировать' ), | |
'update_item' => __( 'Обновить' ), | |
'add_new_item' => __( 'Добавить тэг публикаций' ), | |
'new_item_name' => __( 'Название' ), | |
'menu_name' => __( 'Тэги публикаций' ), | |
); | |
register_taxonomy('booktag','book', array( | |
'hierarchical' => false, | |
'labels' => $labels_booktag, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'booktag' ), | |
)); | |
} | |
add_action( 'init', 'create_booktag_taxonomy', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment