Advertisement
Umbercode

Taxonomy Problem

Aug 31st, 2012
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.99 KB | None | 0 0
  1. function addTaxonomies() {
  2.     $labels = array(
  3.         'name'               => __("Product types", MBRSHP_NAME),
  4.         'singular_name'      => __("Product type", MBRSHP_NAME),
  5.         'add_new'            => __("Add New", MBRSHP_NAME),
  6.         'add_new_item'       => __("Add New Product type", MBRSHP_NAME),
  7.         'edit_item'          => __("Edit Product type", MBRSHP_NAME),
  8.         'new_item'           => __("New Product type", MBRSHP_NAME),
  9.         'all_items'          => __("All Product types", MBRSHP_NAME),
  10.         'view_item'          => __("View Product type", MBRSHP_NAME),
  11.         'search_items'       => __("Search Product types", MBRSHP_NAME),
  12.         'not_found'          => __("No Product types found", MBRSHP_NAME),
  13.         'not_found_in_trash' => __("No Product types found in Trash", MBRSHP_NAME),
  14.         'menu_name'          => __("Product types", MBRSHP_NAME));
  15.  
  16.     $args = array(
  17.         'labels'                   => $labels,
  18.         'public'                   => true,
  19.         'show_tagcloud'            => false,
  20.         'hierarchical'             => false,
  21.         'capabilities'             => array(
  22.             'manage_terms'         => 'manage_types',
  23.             'edit_terms'           => 'manage_types',
  24.             'delete_terms'         => 'manage_types',
  25.             'assign_terms'         => 'manage_types'));
  26.  
  27.     register_taxonomy("product_type", array("product"), $args);
  28.  
  29.     $labels = array(
  30.         'name'               => __("Product categories", MBRSHP_NAME),
  31.         'singular_name'      => __("Product category", MBRSHP_NAME),
  32.         'add_new'            => __("Add New", MBRSHP_NAME),
  33.         'add_new_item'       => __("Add New Product category", MBRSHP_NAME),
  34.         'edit_item'          => __("Edit Product category", MBRSHP_NAME),
  35.         'new_item'           => __("New Product category", MBRSHP_NAME),
  36.         'all_items'          => __("All Product category", MBRSHP_NAME),
  37.         'view_item'          => __("View Product category", MBRSHP_NAME),
  38.         'search_items'       => __("Search Product categories", MBRSHP_NAME),
  39.         'not_found'          => __("No Product categories found", MBRSHP_NAME),
  40.         'not_found_in_trash' => __("No Product categories found in Trash", MBRSHP_NAME),
  41.         'menu_name'          => __("Product categories", MBRSHP_NAME));
  42.  
  43.     $args = array(
  44.         'labels'                   => $labels,
  45.         'public'                   => true,
  46.         'show_tagcloud'            => false,
  47.         'hierarchical'             => true,
  48.         'capabilities'             => array(
  49.             'manage_terms'         => 'manage_categories',
  50.             'edit_terms'           => 'manage_categories',
  51.             'delete_terms'         => 'manage_categories',
  52.             'assign_terms'         => 'manage_categories'));
  53.  
  54.     register_taxonomy("product_cat", array("product"), $args);
  55.  
  56.     $labels = array(
  57.         'name'               => __("Product tags", MBRSHP_NAME),
  58.         'singular_name'      => __("Product tag", MBRSHP_NAME),
  59.         'add_new'            => __("Add New", MBRSHP_NAME),
  60.         'add_new_item'       => __("Add New Product tag", MBRSHP_NAME),
  61.         'edit_item'          => __("Edit Product tag", MBRSHP_NAME),
  62.         'new_item'           => __("New Product tag", MBRSHP_NAME),
  63.         'all_items'          => __("All Product tags", MBRSHP_NAME),
  64.         'view_item'          => __("View Product tag", MBRSHP_NAME),
  65.         'search_items'       => __("Search Product tag", MBRSHP_NAME),
  66.         'not_found'          => __("No Product tags found", MBRSHP_NAME),
  67.         'not_found_in_trash' => __("No Product tags found in Trash", MBRSHP_NAME),
  68.         'menu_name'          => __("Product tags", MBRSHP_NAME));
  69.  
  70.     $args = array(
  71.         'labels'                   => $labels,
  72.         'public'                   => true,
  73.         'show_tagcloud'            => false,
  74.         'hierarchical'             => false,
  75.         'capabilities'             => array(
  76.             'manage_terms'         => 'manage_tags',
  77.             'edit_terms'           => 'manage_tags',
  78.             'delete_terms'         => 'manage_tags',
  79.             'assign_terms'         => 'manage_tags'));
  80.  
  81.     register_taxonomy("product_tag", array("product"), $args);
  82. }
  83.  
  84. function addPostTypes() {
  85.     $labels = array(
  86.         'name'               => __("Products", MBRSHP_NAME),
  87.         'singular_name'      => __("Product", MBRSHP_NAME),
  88.         'add_new'            => __("Add New", MBRSHP_NAME),
  89.         'add_new_item'       => __("Add New Product", MBRSHP_NAME),
  90.         'edit_item'          => __("Edit Product", MBRSHP_NAME),
  91.         'new_item'           => __("New Product", MBRSHP_NAME),
  92.         'all_items'          => __("All Products", MBRSHP_NAME),
  93.         'view_item'          => __("View Product", MBRSHP_NAME),
  94.         'search_items'       => __("Search Product", MBRSHP_NAME),
  95.         'not_found'          => __("No Products found", MBRSHP_NAME),
  96.         'not_found_in_trash' => __("No Products found in Trash", MBRSHP_NAME),
  97.         'menu_name'          => __("Product", MBRSHP_NAME));
  98.  
  99.     $args = array(
  100.         'labels'                   => $labels,
  101.         'description'              => __("Sellable Products", MBRSHP_NAME),
  102.         'public'                   => true,
  103.         'show_ui'                  => true,
  104.         'menu_position'            => 30, // Below comments
  105.         'menu_icon'                => "/assets/img/cart.png",
  106.         'capability_type'          => 'post',
  107.         'supports'                 => array("title",
  108.                                             "editor",
  109.                                             "excerpt",
  110.                                             "thumbnail",
  111.                                             "comments",
  112.                                             "custom-fields",
  113.                                             "page-attributes"),
  114.         'has_archive'              => true,
  115.         'rewrite'                  => true);
  116.  
  117.     register_post_type("product", $args);
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement