Advertisement
Guest User

Custom post, taxonomy, and role

a guest
Mar 18th, 2011
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. $coupon_manager = add_role("coupon_manager", "Coupon Manager");
  2. $coupon_manager->add_cap( 'edit_coupons' );
  3. $coupon_manager->add_cap( 'edit_coupon' );
  4. $coupon_manager->add_cap( 'delete_coupon' );
  5. $coupon_manager->add_cap( 'delete_coupons' );
  6. $coupon_manager->add_cap( 'read_coupons' );
  7. $coupon_manager->add_cap( 'upload_files' );
  8. $coupon_manager->add_cap( 'read' );
  9.  
  10.  
  11. $labels = array(
  12. 'name' => _x('Coupons', 'post type general name'),
  13. 'singular_name' => _x('Coupon', 'post type singular name'),
  14. 'add_new' => _x('Add Coupon', 'coupon'),
  15. 'add_new_item' => __('Add New Coupon'),
  16. 'edit_item' => __('Edit Coupon'),
  17. 'new_item' => __('New Coupon'),
  18. 'view_item' => __('View Coupon'),
  19. 'search_items' => __('Search Coupons'),
  20. 'not_found' => __('No coupons found'),
  21. 'not_found_in_trash' => __('No coupons found in Trash'),
  22. 'parent_item_colon' => '',
  23. 'parent' => 'Parent Coupon'
  24. );
  25. $args = array(
  26. 'labels' => $labels,
  27. 'public' => true,
  28. 'publicly_queryable' => true,
  29. '_builtin' => false,
  30. 'show_ui' => true,
  31. 'query_var' => true,
  32. 'rewrite' => array('slug'=>'coupon'),
  33. 'hierarchical' => false,
  34. 'menu_position' => null,
  35. 'taxonomies' => array('couponbook'),
  36. 'supports' => array('title','author','thumbnail','page-attributes','revisions'),
  37. 'capability_type' => 'coupon'
  38. );
  39. register_post_type('coupon',$args);
  40.  
  41.  
  42. $labels = array(
  43. 'name' => _x( 'Coupon Books', 'taxonomy general name' ),
  44. 'singular_name' => _x( 'Coupon Book', 'taxonomy singular name' ),
  45. 'search_items' => __( 'Search Coupon Books' ),
  46. 'all_items' => __( 'All Coupon Books' ),
  47. 'parent_item' => __( 'Parent Coupon Book' ),
  48. 'parent_item_colon' => __( 'Parent Coupon Book:' ),
  49. 'edit_item' => __( 'Edit Coupon Book' ),
  50. 'update_item' => __( 'Update Coupon Book' ),
  51. 'add_new_item' => __( 'Add New Coupon Book' ),
  52. 'new_item_name' => __( 'New Coupon Book Name' )
  53. );
  54.  
  55. $settings = array(
  56. 'hierarchical' => true,
  57. 'capability_type' => 'couponbook',
  58. 'labels' => $labels,
  59. 'show_ui' => true,
  60. 'rewrite' => array( 'slug' => 'couponbook' )
  61. );
  62.  
  63. register_taxonomy('couponbook', array('coupon'), $settings);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement