$label ) { register_post_status( $slug, array( 'label' => esc_html( $label ), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, /* translators: 1: booking count, 2: booking count */ 'label_count' => _n_noop( 'Booking (%s)', 'Booking (%s)', 'easy-hotel' ), ) ); } } // remove unnecessary thirdparty metaboxes function customize_meta_boxes() { remove_meta_box( 'slider_revolution_metabox', ['eshb_booking', 'eshb_accomodation', 'eshb_service', 'eshb_session', 'eshb_coupon', 'eshb_booking_request', 'eshb_payment', 'eshb_email_template'], 'side' ); // Custom Fields meta box remove_meta_box( 'astra_settings_meta_box', ['eshb_booking', 'eshb_accomodation', 'eshb_service', 'eshb_session', 'eshb_coupon', 'eshb_booking_request', 'eshb_payment', 'eshb_email_template'], 'side' ); // Custom Fields meta box remove_meta_box( 'submitdiv', ['eshb_booking'], 'side' ); // Custom Fields meta box add_meta_box( 'submitdiv', __( 'Update Booking', 'easy-hotel' ), [$this, 'render_submit_meta_box_booking'], 'eshb_booking', 'side', 'default' ); $plugin_name = 'EHB Manual Booking'; $plugin_slug = 'ehb-manual-booking'; $plugin_url = 'https://themewant.com/downloads/'.$plugin_slug; $plugin_main_file = $plugin_slug . '/' . $plugin_slug . '.php'; if (! is_plugin_active( $plugin_main_file ) ) { remove_meta_box( 'submitdiv', ['eshb_payment'], 'side' ); // Custom Fields meta box add_meta_box( 'submitdiv', __( 'Update Payment', 'easy-hotel' ), [$this, 'render_submit_meta_box_payment'], 'eshb_payment', 'side', 'default' ); } } public function render_submit_meta_box_booking( $post, $metabox ) { $postTypeObject = get_post_type_object( 'eshb_booking' ); $can_publish = current_user_can( $postTypeObject->cap->publish_posts ); $postStatus = get_post_status( $post->ID ); $statuses = ESHB_Helper::eshb_get_booking_statuses(); $post_date = date_i18n( 'F j, Y g:i a', strtotime($post->post_date) ); ?>
' . $message . '
'; } else { $message = '' . $message . ''; } } return $message; } } new ESHB_Metabox_Settings(); add_action( 'admin_footer-post.php', 'eshb_add_all_custom_statuses_to_dropdown' ); add_action( 'admin_footer-post-new.php', 'eshb_add_all_custom_statuses_to_dropdown' ); function eshb_add_all_custom_statuses_to_dropdown() { global $post; if ( $post->post_type !== 'eshb_booking'|| $post->post_type !== 'eshb_payment' ) return; $statuses = ESHB_Helper::eshb_get_booking_statuses(); ?> _x( 'Deposit Payment', 'Order status', 'easy-hotel' ), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, /* translators: 1: depoist payment count, 2: depoist payment count */ 'label_count' => _n_noop( 'Deposit Payment (%s)', 'Deposit Payment (%s)', 'easy-hotel' ), ) ); } function eshb_add_custom_order_status_to_woocommerce($order_statuses) { // Place it after processing $new_order_statuses = array(); foreach ($order_statuses as $key => $status) { $new_order_statuses[$key] = $status; if ('wc-processing' === $key) { $new_order_statuses['wc-deposit-payment'] = __('Deposit Payment', 'easy-hotel'); } } return $new_order_statuses; } // allow payment for this status add_filter( 'wc_order_is_pending_status', 'eshb_enable_payment_for_custom_status' ); function eshb_enable_payment_for_custom_status( $statuses ) { $statuses[] = 'deposit-payment'; return $statuses; } add_filter( 'woocommerce_resend_order_emails_available', 'eshb_enable_resend_email_for_custom_status', 10, 1 ); function eshb_enable_resend_email_for_custom_status( $emails ) { $emails[] = 'customer_invoice'; // Invoice email with payment link return $emails; }