$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) ); ?>
ID ) ) { if ( ! EMPTY_TRASH_DAYS ) { $delete_text = __( 'Delete Permanently', 'easy-hotel' ); } else { $delete_text = __( 'Move to Trash', 'easy-hotel' ); } ?>

post_type, ['eshb_booking', 'eshb_payment']) ) { $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_submenu_page( 'edit.php?post_type=eshb_booking', 'post-new.php?post_type=eshb_booking' ); // Remove the "Add New" button on top of the list table if(in_array($screen->post_type, ['eshb_booking'])){ $this->modify_title_actions( __( 'New Booking', 'easy-hotel' ), '#', array( 'class' => 'button-disabled', 'after' => $this->eshb_upgrade_message($plugin_name, $plugin_url) ) ); }else{ $this->modify_title_actions( __( 'New Payment', 'easy-hotel' ), '#', array( 'class' => 'button-disabled', 'after' => $this->eshb_upgrade_message($plugin_name, $plugin_url) ) ); } } } } public function render_submit_meta_box_payment ($post, $metabox){ $plugin_name = 'EHB Manual Booking'; $plugin_slug = 'ehb-manual-booking'; $plugin_url = 'https://themewant.com/downloads/'.$plugin_slug; echo esc_html($this->eshb_upgrade_message($plugin_name, $plugin_url, 'div')); } public function modify_title_actions( $label, $url, $options = array() ) { $this->title_actions[] = array( 'label' => $label, 'class' => 'eshb-page-title-action button ' . ( $options['class'] ?? '' ), 'url' => $url, 'after' => ! empty( $options['after'] ) ? ' ' . $options['after'] : '', ); } public function title_actions_script() { if ( empty( $this->title_actions ) ) { return; } $actions = array_map( function( $action ) { $html = ''; $html .= esc_html( $action['label'] ) . ''; $html .= ! empty( $action['after'] ) ? wp_kses_post( $action['after'] ) : ''; return $html; }, $this->title_actions ); ?> %2$s extension to access this feature.', 'easy-hotel' ), esc_url( $plugin_url ), esc_html( $plugin_name ) ); if ( ! empty( $wrapper ) ) { if ( $wrapper === 'div' ) { $message = '
' . $message . '
'; }elseif($wrapper === 'p'){ $message = '

' . $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; }