Skip to content

Instantly share code, notes, and snippets.

@aslamhindko
Created October 14, 2016 05:42
Show Gist options
  • Save aslamhindko/c3c81e59912a1bc276a4e47484c30faf to your computer and use it in GitHub Desktop.
Save aslamhindko/c3c81e59912a1bc276a4e47484c30faf to your computer and use it in GitHub Desktop.
<!--Agar Post Type main catgory banani ho tu postype main regester_taxonomy banage -->
/**
* Create a taxonomy
*
* @uses Inserts new taxonomy object into the list
* @uses Adds query vars
*
* @param string Name of taxonomy object
* @param array|string Name of the object type for the taxonomy object.
* @param array|string Taxonomy arguments
* @return null|WP_Error WP_Error if errors, otherwise null.
*/
function productstaxonomies() {
$labels = array(
'name' => _x( 'Product category', 'Taxonomy Product category', 'text-domain' ),
'singular_name' => _x( 'Product Category', 'Taxonomy Product Category', 'text-domain' ),
'search_items' => __( 'Search Product category', 'text-domain' ),
'popular_items' => __( 'Popular Product category', 'text-domain' ),
'all_items' => __( 'All Product category', 'text-domain' ),
'parent_item' => __( 'Parent Product Category', 'text-domain' ),
'parent_item_colon' => __( 'Parent Product Category', 'text-domain' ),
'edit_item' => __( 'Edit Product Category', 'text-domain' ),
'update_item' => __( 'Update Product Category', 'text-domain' ),
'add_new_item' => __( 'Add New Product Category', 'text-domain' ),
'new_item_name' => __( 'New Product Categ Name', 'text-domain' ),
'add_or_remove_items' => __( 'Add or remove Product category', 'text-domain' ),
'choose_from_most_used' => __( 'Choose from most used text-domain', 'text-domain' ),
'menu_name' => __( 'Product Category', 'text-domain' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_admin_column' => false,
'hierarchical' => true,
'show_tagcloud' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'query_var' => true,
'capabilities' => array(),
);
register_taxonomy( 'product_category', array( 'products' ), $args );----> yaha postype dege jis k liye category banai hain
}
add_action( 'init', 'productstaxonomies' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment