样式多个自定义订单状态

时间:2020-04-11 21:27:50

标签: php woocommerce orders

如何更改以下文本以适用于两种自定义订单状态样式?它适用于一个,但不能同时适用于两个。

// ADD COLOR TO IN PROGRESS BUTTON
add_action('admin_head', 'styling_admin_order_list' );
function styling_admin_order_list() {
    global $pagenow, $post;

    if( $pagenow != 'edit.php') return; // Exit
    if( get_post_type($post->ID) != 'shop_order' ) return; // Exit

    // HERE below set your custom status
    $order_status = 'awaiting shipment'; // <==== HERE
    ?>
    <style>
        .order-status.status-<?php echo sanitize_title( $order_status ); ?> {
            background: #cc0099;
            color: #ffffff;
        }
    </style>
         $order_status = 'shipped'; // <==== HERE
    ?>
    <style>
        .order-status.status-<?php echo sanitize_title( $order_status ); ?> {
            background: ##34cfeb;
            color: #ffffff;
        }
    </style>
           <?php
}

0 个答案:

没有答案