get_status() ) ); } ); // The sentence at the top of an order's page. Only the status inside it changes, so it stays translated. add_filter( 'woocommerce_order_details_status', function ( $text, $order ) { if ( ! sofrah_board_is_board_order( $order ) ) { return $text; } $label = esc_html( sofrah_board_status_label( sofrah_board_get_status( $order ) ) ); return preg_replace_callback( '/().*?(<\/mark>)/s', function ( $m ) use ( $label ) { return $m[1] . $label . $m[2]; }, $text ); }, 10, 2 ); // The way to the status page, in the list and on the order's page. add_filter( 'woocommerce_my_account_my_orders_actions', function ( $actions, $order ) { if ( ! sofrah_board_is_board_order( $order ) ) { return $actions; } return array( 'sofrah-status' => array( 'url' => sofrah_board_status_url( $order ), 'name' => __( 'Status page', 'sofrah-order-board' ), /* translators: %s: order number */ 'aria-label' => sprintf( __( 'Status page for order %s', 'sofrah-order-board' ), $order->get_order_number() ), ), ) + $actions; }, 10, 2 );