Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $labels = array(
- 'name' => _x( 'Product Categories', 'taxonomy general name' ),
- 'singular_name' => __( 'Product Category', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Categories' ),
- 'all_items' => __( 'All Categories' ),
- 'edit_item' => __( 'Edit Category' ),
- 'update_item' => __( 'Update Category' ),
- 'add_new_item' => __( 'Add New Category' ),
- 'new_item_name' => __( 'New Category' ),
- 'menu_name' => __( 'Product Categories' ),
- );
- register_taxonomy('product_categories', array('products'), array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'query_var' => true,
- 'rewrite' => array('slug' => '', 'with_front' => false)
- ));
- add_action('init', 'products');
- function products()
- {
- $labels = array(
- 'name' => _x('Products', 'post type general name'),
- 'singular_name' => _x('Product', 'post type singular name'),
- 'add_new' => _x('Add New', 'products'),
- 'add_new_item' => __('Add New Product'),
- 'edit_item' => __('Edit Product'),
- 'new_item' => __('New Product'),
- 'view_item' => __('View Product'),
- 'search_items' => __('Search Products'),
- 'not_found' => __('No products found'),
- 'not_found_in_trash' => __('No products found in Trash'),
- 'parent_item_colon' => ''
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'exclude_from_search' => false,
- 'show_ui' => true,
- 'query_var' => true,
- 'capability_type' => 'post',
- 'taxonomies' => array('product_categories'),
- 'hierarchical' => false,
- 'has_archive' => 'products',
- 'can_export' => true,
- 'supports' => array('title', 'thumbnail', 'page-attributes', 'editor', 'excerpt'),
- 'rewrite' => array('slug' => '', 'with_front' => false)
- );
- register_post_type('products',$args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement