rakeshr

Untitled

Mar 29th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. function wpg_distributor() {
  2. $labels = array(
  3. 'name' => _x( 'distributors', 'post type general name' ),
  4. 'singular_name' => _x( 'distributor', 'post type singular name' ),
  5. 'add_new' => _x( 'Add New', 'Distributor' ),
  6. 'add_new_item' => __( 'Add New Distributor' ),
  7. 'edit_item' => __( 'Edit Distributor' ),
  8. 'new_item' => __( 'New Distributor' ),
  9. 'all_items' => __( 'All Distributors' ),
  10. 'view_item' => __( 'View Distributor' ),
  11. 'search_items' => __( 'Search Distributors' ),
  12. 'not_found' => __( 'No distributor found' ),
  13. 'not_found_in_trash' => __( 'No distributor found in the Trash' ),
  14. 'parent_item_colon' => '',
  15. 'menu_name' => 'Distributors'
  16. );
  17. $args = array(
  18. 'labels' => $labels,
  19. 'description' => 'Distributors',
  20. 'public' => true,
  21. 'menu_position' => 38,
  22. 'show_ui' => true,
  23. 'show_in_menu' => true,
  24. 'query_var' => true,
  25. 'capability_type' => 'post',
  26. 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail', 'comments'),
  27. 'has_archive' => true,
  28. 'exclude_from_search' => true,
  29. );
  30. register_post_type( 'distributors', $args );
  31. }
  32. add_action( 'init', 'wpg_distributor' );
  33. // events cpt ends //
  34.  
  35. // events custom categories //
  36. add_action( 'init', 'create_distributor_taxonomies', 0 );
  37.  
  38. function create_distributor_taxonomies() {
  39. // Add new taxonomy, make it hierarchical (like categories)
  40. $labels = array(
  41. 'name' => _x( 'Categories', 'taxonomy general name' ),
  42. 'singular_name' => _x( 'Category', 'taxonomy singular name' ),
  43. 'search_items' => __( 'Search Categories' ),
  44. 'all_items' => __( 'All Categories' ),
  45. 'parent_item' => __( 'Parent Category' ),
  46. 'parent_item_colon' => __( 'Parent Category:' ),
  47. 'edit_item' => __( 'Edit Category' ),
  48. 'update_item' => __( 'Update Category' ),
  49. 'add_new_item' => __( 'Add New Category' ),
  50. 'new_item_name' => __( 'New Category Name' ),
  51. 'menu_name' => __( 'Categories' ),
  52. );
  53. $args = array(
  54. 'hierarchical' => true,
  55. 'labels' => $labels,
  56. 'show_ui' => true,
  57. 'show_admin_column' => true,
  58. 'query_var' => true,
  59. 'rewrite' => array( 'slug' => 'category', 'with_front' => false ),
  60. );
  61. register_taxonomy( 'distributor_category', array( 'distributors' ), $args );
  62. }
Add Comment
Please, Sign In to add comment