Created
July 20, 2015 08:07
-
-
Save AlkarE/d74ae491808fad9848d8 to your computer and use it in GitHub Desktop.
product_category_taxonomy
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
<?php | |
/*Plugin Name: Create product Category Taxonomy | |
Description: This plugin registers the 'product category' taxonomy and applies it to the 'product' post type. | |
Version: 1.0 | |
License: GPLv2 | |
*/ | |
function product_register_taxonomy() { | |
// set up labels | |
$labels = array( | |
'name' => 'Product Categories', | |
'singular_name' => 'Product Category', | |
'search_items' => 'Search Product Categories', | |
'all_items' => 'All Product Categories', | |
'edit_item' => 'Edit Product Category', | |
'update_item' => 'Update Product Category', | |
'add_new_item' => 'Add New Product Category', | |
'new_item_name' => 'New Product Category', | |
'menu_name' => 'Product Categories' | |
); | |
// register taxonomy | |
register_taxonomy( 'productcat', 'product', array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'query_var' => true, | |
'show_admin_column' => true | |
) ); | |
} | |
add_action( 'init', 'product_register_taxonomy' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment