Created
March 19, 2014 03:49
-
-
Save 1shiharat/9635143 to your computer and use it in GitHub Desktop.
custom taxonomy create.
This file contains 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 news_custom_taxonomy() { | |
$labels = array( | |
'name' => _x( 'ニュースカテゴリ', 'Taxonomy General Name', 'text_domain' ), | |
'singular_name' => _x( 'ニュースカテゴリ', 'Taxonomy Singular Name', 'text_domain' ), | |
'menu_name' => __( 'ニュースカテゴリ', 'text_domain' ), | |
'all_items' => __( 'すべてのニュースカテゴリ', 'text_domain' ), | |
'parent_item' => __( '親カテゴリ', 'text_domain' ), | |
'parent_item_colon' => __( '親カテゴリ:', 'text_domain' ), | |
'new_item_name' => __( '新しいカテゴリ', 'text_domain' ), | |
'add_new_item' => __( '新しいカテゴリを追加', 'text_domain' ), | |
'edit_item' => __( 'カテゴリを編集', 'text_domain' ), | |
'update_item' => __( 'カテゴリを更新', 'text_domain' ), | |
'separate_items_with_commas' => __( 'アイテムをカンマで区切る', 'text_domain' ), | |
'search_items' => __( 'カテゴリを検索', 'text_domain' ), | |
'add_or_remove_items' => __( '追加、または削除', 'text_domain' ), | |
'choose_from_most_used' => __( 'Choose from the most used items', 'text_domain' ), | |
'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( 'news_category', array( 'news' ), $args ); | |
} | |
// Hook into the 'init' action | |
add_action( 'init', 'news_custom_taxonomy', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can create custom taxonomy in WordPress using this simple code in functions.php
Reference : https://www.wpblog.com/create-custom-taxonomies-in-wordpress/