certainlyakey
3/3/2014 - 9:34 PM

Wordpress - register custom taxonomy for custom post type

Wordpress - register custom taxonomy for custom post type

	//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 );