handle order projects
This commit is contained in:
@@ -3,9 +3,6 @@
|
||||
class Wiaas_Admin_Order_Projects {
|
||||
|
||||
public static function init() {
|
||||
// Add admin page and subpage since woocommerce orders have custom menu page
|
||||
// so this will not be automatic
|
||||
add_filter('admin_menu', array(__CLASS__, 'add_admin_page'));
|
||||
|
||||
// Add is available fields to create and edit forms
|
||||
add_action( 'shop_order_project_add_form_fields', array( __CLASS__, 'add_is_available_field' ) );
|
||||
@@ -18,18 +15,20 @@ class Wiaas_Admin_Order_Projects {
|
||||
// Save is available field when creating and editing
|
||||
add_action( 'created_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
||||
add_action( 'edit_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
||||
|
||||
add_action( 'load-term.php', array( __CLASS__, 'admin_menu_highlight' ) );
|
||||
add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_menu_highlight' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add admin submenu page for order projects
|
||||
* Highlighting orders menu when shop orders page selected
|
||||
*/
|
||||
public static function add_admin_page() {
|
||||
add_submenu_page( 'woocommerce',
|
||||
esc_html__( 'Order projects', 'wiaas' ),
|
||||
esc_html__( 'Order projects', 'wiaas' ),
|
||||
'manage_woocommerce',
|
||||
'edit-tags.php?taxonomy=shop_order_project'
|
||||
);
|
||||
public static function admin_menu_highlight() {
|
||||
global $plugin_page;
|
||||
|
||||
if ( isset( $_GET['taxonomy'] ) && ( $_GET['taxonomy'] === 'shop_order_project' ) ) {
|
||||
$plugin_page = 'edit.php?post_type=shop_order';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user