Advertisement
Guest User

Untitled

a guest
Aug 7th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.94 KB | None | 0 0
  1. // Products Section
  2. function all_procucts_custom() {
  3.  
  4.     $labels = array(
  5.         'name'                => _x( 'Products', 'Post Type General Name', 'text_domain' ),
  6.         'singular_name'       => _x( 'Product', 'Post Type Singular Name', 'text_domain' ),
  7.         'menu_name'           => __( 'Products', 'text_domain' ),
  8.         'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),
  9.         'all_items'           => __( 'All Products', 'text_domain' ),
  10.         'view_item'           => __( 'View Product', 'text_domain' ),
  11.         'add_new_item'        => __( 'Add New Product', 'text_domain' ),
  12.         'add_new'             => __( 'Add New Product', 'text_domain' ),
  13.         'edit_item'           => __( 'Edit Product', 'text_domain' ),
  14.         'update_item'         => __( 'Update Product', 'text_domain' ),
  15.         'search_items'        => __( 'Search Product', 'text_domain' ),
  16.         'not_found'           => __( 'Not found', 'text_domain' ),
  17.         'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
  18.     );
  19.     $args = array(
  20.         'label'               => __( 'all_products', 'text_domain' ),
  21.         'description'         => __( 'All Products', 'text_domain' ),
  22.         'labels'              => $labels,
  23.         'supports'            => array( 'title', 'thumbnail', ),
  24.         'taxonomies'          => array( 'product-cat', 'app' ),
  25.         'hierarchical'        => false,
  26.         'public'              => true,
  27.         'rewrite' => array('slug' => 'products', 'with_front' => false),
  28.         'show_ui'             => true,
  29.         'show_in_menu'        => true,
  30.         'show_in_nav_menus'   => true,
  31.         'show_in_admin_bar'   => true,
  32.         'menu_position'       => 5,
  33.         'menu_icon'           => 'dashicons-forms',
  34.         'can_export'          => true,
  35.         'has_archive'         => true,
  36.         'exclude_from_search' => false,
  37.         'publicly_queryable'  => true,
  38.         'capability_type'     => 'page',
  39.     );
  40.     register_post_type( 'all_products', $args );
  41.  
  42. }
  43.  
  44. add_action( 'init', 'all_procucts_custom', 0 );
  45.  
  46. //Taxonomy for Products --Categories
  47. function taxonomy_for_products_cat() {
  48.  
  49.     $labels = array(
  50.         'name'                       => _x( 'Categories', 'Taxonomy General Name', 'text_domain' ),
  51.         'singular_name'              => _x( 'Category', 'Taxonomy Singular Name', 'text_domain' ),
  52.         'menu_name'                  => __( 'Products Categories', 'text_domain' ),
  53.         'all_items'                  => __( 'All Items', 'text_domain' ),
  54.         'parent_item'                => __( 'Parent Item', 'text_domain' ),
  55.         'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),
  56.         'new_item_name'              => __( 'New Item Name', 'text_domain' ),
  57.         'add_new_item'               => __( 'Add New Item', 'text_domain' ),
  58.         'edit_item'                  => __( 'Edit Item', 'text_domain' ),
  59.         'update_item'                => __( 'Update Item', 'text_domain' ),
  60.         'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
  61.         'search_items'               => __( 'Search Items', 'text_domain' ),
  62.         'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),
  63.         'choose_from_most_used'      => __( 'Choose from the most used items', 'text_domain' ),
  64.         'not_found'                  => __( 'Not Found', 'text_domain' ),
  65.     );
  66.     $args = array(
  67.         'labels'                     => $labels,
  68.         'hierarchical'               => true,
  69.         'public'                     => true,
  70.         'show_ui'                    => true,
  71.         'show_admin_column'          => true,
  72.         'show_in_nav_menus'          => true,
  73.         'has_archive'                => true,
  74.         'show_tagcloud'              => true,
  75.         'rewrite'           =>  array('slug' => 'product-cat', 'with_front' => false),
  76.     );
  77.     register_taxonomy( 'product-cat', array( 'all_products' ), $args );
  78.  
  79. }
  80.  
  81. add_action( 'init', 'taxonomy_for_products_cat', 0 );
  82.  
  83. //Taxonomy for Products --Tags
  84. function taxonomy_for_products_tags() {
  85.  
  86.     $labels = array(
  87.         'name'                       => _x( 'Applications', 'Taxonomy General Name', 'text_domain' ),
  88.         'singular_name'              => _x( 'Application', 'Taxonomy Singular Name', 'text_domain' ),
  89.         'menu_name'                  => __( 'Products Applications', 'text_domain' ),
  90.         'all_items'                  => __( 'All Items', 'text_domain' ),
  91.         'parent_item'                => __( 'Parent Item', 'text_domain' ),
  92.         'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),
  93.         'new_item_name'              => __( 'New Item Name', 'text_domain' ),
  94.         'add_new_item'               => __( 'Add New Item', 'text_domain' ),
  95.         'edit_item'                  => __( 'Edit Item', 'text_domain' ),
  96.         'update_item'                => __( 'Update Item', 'text_domain' ),
  97.         'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
  98.         'search_items'               => __( 'Search Items', 'text_domain' ),
  99.         'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),
  100.         'choose_from_most_used'      => __( 'Choose from the most used items', 'text_domain' ),
  101.         'not_found'                  => __( 'Not Found', 'text_domain' ),
  102.     );
  103.     $args = array(
  104.         'labels'                     => $labels,
  105.         'hierarchical'               => false,
  106.         'public'                     => true,
  107.         'rewrite' => array('slug' => 'app','with_front' => FALSE),
  108.         'show_ui'                    => true,
  109.         'has_archive'                => true,
  110.         'show_admin_column'          => true,
  111.         'show_in_nav_menus'          => true,
  112.         'show_tagcloud'              => true,
  113.     );
  114.     register_taxonomy( 'app', array( 'all_products' ), $args );
  115.  
  116. }
  117.  
  118. add_action( 'init', 'taxonomy_for_products_tags', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement