【问题标题】:Woocommerce how to change the color of a checkout field text labelWoocommerce如何更改结帐字段文本标签的颜色
【发布时间】:2021-02-12 17:43:27
【问题描述】:

下午好,

也许有人遇到过这样的问题。如何在结帐中更改已定义字段的文本。所有字段都引用一个标签。

【问题讨论】:

    标签: php css woocommerce woocommerce-theming woocommerce-checkout-fields


    【解决方案1】:

    哪一个?标签的实际text 或其color

    对于标签的实际文本,请使用以下filter 钩子!例如如果你想更改billing section中的first name label

    add_filter('woocommerce_checkout_fields', 'your_custom_checkout_fields', 20);
    
    function your_custom_checkout_fields($fields){
    
        $fields['billing']['billing_first_name']['label'] = 'testing label 101!';
    
        # example of other fields
        # $fields['billing']['billing_last_name']['label'] = 'some label!'; 
        # $fields['billing']['billing_country']['label'] = 'some other label!';
        # $fields['billing']['billing_phone']['label'] = 'other label';
        # $fields['billing']['billing_email']['label'] = 'your label';
    }
    

    如果你想改变它的颜色,那么使用下面的css规则:

    .woocommerce #billing_first_name_field label {
    
      color: pink; /* you could replace pink with any color you want!!! */
    
    }
    

    【讨论】:

    • 感谢您帮助我。我只使用了 css,它帮助了我 .woocommerce #billing_eu_vat_field label { color: #9d2235; }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-07
    • 1970-01-01
    • 2021-06-17
    • 1970-01-01
    • 2020-02-09
    • 2021-12-02
    相关资源
    最近更新 更多