Tags

 
/*  Custome Post Type */

add_action( 'init', 'wp_product' );
function wp_product() {
	register_post_type( 'wp_product',
		array(
			'labels' => array(
				'name' => __( 'WP Catalogue' ),
				'singular_name' => __( 'Product' ),
				'search_items' =>  __( 'Search Product' ),
				'parent_item' => __( 'Parent Product' ),
				'parent_item_colon' => __( 'Parent Product:' ),
				'edit_item' => __( 'Edit Product' ),
				'update_item' => __( 'Update Product' ),
				'add_new_item' => __( 'Add New Product' ),
				'new_item_name' => __( 'New Product Name' ),
				
			),
			'public' => true,
			'has_archive' => true,
			'rewrite' => array('slug' => 'products'),
                        'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments' ),
		)
	);
}

/*------------------------------------------------------------------------------------------------------*/

 /*  Custome Taxonomy Type */

function add_product_taxonomies() {

	register_taxonomy('p_category', 'wp_product', array(
		// Hierarchical taxonomy (like categories)
		'hierarchical' => true,
		// This array of options controls the labels displayed in the WordPress Admin UI
		'labels' => array(
			'name' => _x( 'Product Category', 'taxonomy general name' ),
			'singular_name' => _x( 'Category', 'taxonomy singular name' ),
			'search_items' =>  __( 'Search Categories' ),
			'all_items' => __( 'All Categories' ),
			'parent_item' => __( 'Parent Categories' ),
			'parent_item_colon' => __( 'Parent Categories:' ),
			'edit_item' => __( 'Edit Categories' ),
			'update_item' => __( 'Update Categories' ),
			'add_new_item' => __( 'Add New Categories' ),
			'new_item_name' => __( 'New Categories Name' ),
			'menu_name' => __( 'Categories' ),
		),

		// Control the slugs used for this taxonomy
		'rewrite' => array(
			'slug' => 'p_category', // This controls the base slug that will display before each term
			'with_front' => false, // Don't display the category base before "/locations/"
			'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
		),
	));
}
add_action( 'init', 'add_product_taxonomies', 0 ); 
Advertisements