VTMIN_Backbone

The VarkTech Minimum Purchase for WooCommerce VTMIN Backbone class.

Defined (1)

The class is defined in the following location(s).

/core/vtmin-backbone.php  
  1. class VTMIN_Backbone{  
  2.  
  3. public function __construct() { 
  4. $this->vtmin_register_post_types(); 
  5. $this->vtmin_add_dummy_rule_category(); 
  6. // add_filter( 'post_row_actions', array(&$this, 'vtmin_remove_row_actions'), 10, 2 ); 
  7.  
  8.  
  9. public function vtmin_register_post_types() { 
  10. global $vtmin_info; 
  11.  
  12. $tax_labels = array( 
  13. 'name' => _x( 'Minimum Purchase Categories', 'taxonomy general name', 'vtmin' ),  
  14. 'singular_name' => _x( 'Minimum Purchase Category', 'taxonomy singular name', 'vtmin' ),  
  15. 'search_items' => __( 'Search Minimum Purchase Category', 'vtmin' ),  
  16. 'all_items' => __( 'All Minimum Purchase Categories', 'vtmin' ),  
  17. 'parent_item' => __( 'Minimum Purchase Category', 'vtmin' ),  
  18. 'parent_item_colon' => __( 'Minimum Purchase Category:', 'vtmin' ),  
  19. 'edit_item' => __( 'Edit Minimum Purchase Category', 'vtmin' ),  
  20. 'update_item' => __( 'Update Minimum Purchase Category', 'vtmin' ),  
  21. 'add_new_item' => __( 'Add New Minimum Purchase Category', 'vtmin' ),  
  22. 'new_item_name' => __( 'New Minimum Purchase Category', 'vtmin' ) 
  23. );  
  24.  
  25.  
  26. $tax_args = array( 
  27. 'hierarchical' => true,  
  28. 'labels' => $tax_labels,  
  29. 'show_ui' => true,  
  30. 'query_var' => false,  
  31. 'rewrite' => array( 'slug' => 'vtmin_rule_category', 'with_front' => false, 'hierarchical' => true ) 
  32. ) ;  
  33.  
  34. $taxonomy_name = 'vtmin_rule_category'; 
  35.  
  36.  
  37. //REGISTER TAXONOMY  
  38. register_taxonomy($taxonomy_name, $vtmin_info['applies_to_post_types'], $tax_args);  
  39.  
  40.  
  41. //REGISTER POST TYPE 
  42. $post_labels = array( 
  43. 'name' => _x( 'Minimum Purchase Rules', 'post type name', 'vtmin' ),  
  44. 'singular_name' => _x( 'Minimum Purchase Rule', 'post type singular name', 'vtmin' ),  
  45. 'add_new' => _x( 'Add New', 'admin menu: add new Minimum Purchase Rule', 'vtmin' ),  
  46. 'add_new_item' => __('Add New Minimum Purchase Rule', 'vtmin' ),  
  47. 'edit_item' => __('Edit Minimum Purchase Rule', 'vtmin' ),  
  48. 'new_item' => __('New Minimum Purchase Rule', 'vtmin' ),  
  49. 'view_item' => __('View Minimum Purchase Rule', 'vtmin' ),  
  50. 'search_items' => __('Search Minimum Purchase Rules', 'vtmin' ),  
  51. 'not_found' => __('No Minimum Purchase Rules found', 'vtmin' ),  
  52. 'not_found_in_trash' => __( 'No Minimum Purchase Rules found in Trash', 'vtmin' ),  
  53. 'parent_item_colon' => '',  
  54. 'menu_name' => __( 'Minimum Purchase Rules', 'vtmin' ) 
  55. ); 
  56.  
  57. register_post_type( 'vtmin-rule', array( 
  58. 'capability_type' => 'post',  
  59. 'hierarchical' => true,  
  60. 'exclude_from_search' => true,  
  61. 'labels' => $post_labels,  
  62. 'public' => true,  
  63. 'show_ui' => true,  
  64. 'query_var' => true,  
  65. 'rewrite' => false,  
  66. 'supports' => array('title' ) //remove 'revisions', 'editor' = no content/revisions boxes  
  67. ); 
  68.  
  69. // $role = get_role( 'administrator' ); //v1.09.1 removed for conflict 
  70. // $role->add_cap( 'read_vtmin-rule' ); //v1.09.1 removed for conflict  
  71.  
  72. public function vtmin_add_dummy_rule_category () { 
  73. $category_list = get_terms( 'vtmin_rule_category', 'hide_empty=0&parent=0' ); 
  74. if ( count( $category_list ) == 0 ) { 
  75. wp_insert_term( __( 'Minimum Purchase Category', 'vtmin' ), 'vtmin_rule_category', "parent=0" ); 
  76.  
  77.  
  78. /**------------------------------------------------------------------------------------ 
  79. remove quick edit for custom post type  
  80. ------------------------------------------------------------------------------------*/ 
  81. /** 
  82. public function vtmin_remove_row_actions( $actions, $post ) 
  83. global $current_screen; 
  84. if( $current_screen->post_type = 'vtmin-rule' ) { 
  85. unset( $actions['edit'] ); 
  86. unset( $actions['view'] ); 
  87. unset( $actions['trash'] ); 
  88. unset( $actions['inline hide-if-no-js'] ); 
  89. //$actions['inline hide-if-no-js'] .= __( 'Quick Edit' ); 
  90. return $actions; 
  91. */ 
  92.  
  93.  
  94.  
  95.  
  96.  
  97. function vtmin_register_settings() { 
  98. register_setting( 'vtmin_options', 'vtmin_rules' ); 
  99. }  
  100.  
  101.  
  102. } //end class