Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function register_product() {
- $labels = array(
- 'name' => _x('Catalog', 'post type general name','LADS'),
- 'singular_name' => _x('Product', 'post type singular name','LADS'),
- 'add_new' => _x('Add','LADS'),
- 'add_new_item' => __('Add','LADS'),
- 'edit_item' => __('Edit','LADS'),
- 'new_item' => __('Add','LADS'),
- 'all_items' => __('All','LADS'),
- 'view_item' => __('View','LADS'),
- 'search_items' => __('Search','LADS'),
- 'not_found' => __('Nothing Found','LADS'),
- 'not_found_in_trash' => __('Nothing Found','LADS'),
- 'parent_item_colon' => ''
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'catalog' ),
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'menu_position' => null,
- 'taxonomies' => 'product_category',
- 'supports' => array('title','editor','thumbnail','excerpt','comments','revisions','custom-fields')
- );
- register_post_type( 'product' , $args );
- }
- add_action('init', 'register_product');
- function create_product_taxonomies() {
- // product category taxonomy
- $labels = array(
- 'name' => _x( 'Categories', 'taxonomy general name' ),
- 'singular_name' => _x( 'Category', 'taxonomy singular name' ),
- 'search_items' => __( 'Search'),
- 'all_items' => __( 'All' ),
- 'parent_item' => __( 'Parent' ),
- 'parent_item_colon' => __( 'Parent'),
- 'edit_item' => __( 'Edit' ),
- 'update_item' => __( 'Edit' ),
- 'add_new_item' => __( 'Add new' ),
- 'new_item_name' => __( 'Add new' ),
- 'menu_name' => __( 'Categories' ),
- );
- $args = array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'show_in_nav_menus' => true,
- 'rewrite' => array( 'slug' => 'k' )
- );
- register_taxonomy( 'product_category', array( 'product', 'page'), $args );
- // product brand taxonomy
- $labels = array(
- 'name' => _x( 'Producers', 'taxonomy general name' ),
- 'singular_name' => _x( 'Producer', 'taxonomy singular name' ),
- 'search_items' => __( 'Search'),
- 'all_items' => __( 'All' ),
- 'parent_item' => __( 'Parent' ),
- 'parent_item_colon' => __( 'Parent'),
- 'edit_item' => __( 'Edit' ),
- 'update_item' => __( 'Edit' ),
- 'add_new_item' => __( 'Add new' ),
- 'new_item_name' => __( 'Add new' ),
- 'menu_name' => __( 'Producers' ),
- );
- $args = array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'rewrite' => false,
- );
- register_taxonomy('product_brand', array( 'product' ), $args );
- }
- add_action( 'init', 'create_product_taxonomies', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement