mercredi 29 juillet 2020

Does anybody know how to change the color depending on stringname?

I try to change the color of an order-status-span-element to color red, if the order status is "Pending payment".
As soon as the status changes to "completed", the span text color should switch to green.
I tried to insert a proper if-statement, but I don't know which variable I need to go for.

<div class="order-status">
        <span>Order Status</span>
        <?php elseif ( 'order-status' === $column_id ) : ?>
        <?php echo '<span id="order-status-value">' . esc_html( wc_get_order_status_name( $order->get_status() ) ) . '<span>'; 
            if ( strcasecmp( wc_get_order_status_name( $order->get_status() ) == 0 ) :
                echo "This String works";
        ?>      
                <style type="text/css">
                    #order-status-value {
                        color: green;
                    }
                </style>
    </div>

Thank you in advance,
Chris

Aucun commentaire:

Enregistrer un commentaire