Created
September 28, 2012 18:27
-
-
Save GreggFranklin/3801403 to your computer and use it in GitHub Desktop.
CPT & Taxonomy
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_post_type( 'products', | |
array( | |
'labels' => array( | |
'name' => __( 'Products','office' ), | |
'singular_name' => __( 'Products','office' ), | |
'add_new' => _x( 'Add New', 'Product','office' ), | |
'add_new_item' => __( 'Add Product','office' ), | |
'edit_item' => __( 'Edit Product','office' ), | |
'new_item' => __( 'New Product','office' ), | |
'view_item' => __( 'View Product','office' ), | |
'search_items' => __( 'Search Product','office' ), | |
'not_found' => __( 'No Product found','office' ), | |
'not_found_in_trash' => __( 'No Product found in Trash','office' ), | |
'parent_item_colon' => '' | |
), | |
'public' => true, | |
'supports' => array('title','editor','thumbnail'), | |
'menu_icon' => get_template_directory_uri() . '/images/admin/icon-product.png', | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'products' ), | |
) | |
); | |
// Products taxonomies | |
$products_cat_labels = array( | |
'name' => __( 'Product Categories', 'office' ), | |
'singular_name' => __( 'Category', 'office' ), | |
'search_items' => __( 'Search Categories', 'office' ), | |
'all_items' => __( 'All Categories', 'office' ), | |
'parent_item' => __( 'Parent Category', 'office' ), | |
'parent_item_colon' => __( 'Parent Category:', 'office' ), | |
'edit_item' => __( 'Edit Categories', 'office' ), | |
'update_item' => __( 'Update Categories', 'office' ), | |
'add_new_item' => __( 'Add New Category', 'office' ), | |
'new_item_name' => __( 'New Category', 'office' ), | |
'choose_from_most_used' => __( 'Choose from the most used Categories', 'office' ) | |
); | |
register_taxonomy('products_cats','products',array( | |
'hierarchical' => true, | |
'labels' => $products_cat_labels, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'products' ), | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment