【问题标题】:WooCommerce checkout field for date input用于日期输入的 WooCommerce 结帐字段
【发布时间】:2015-12-22 11:26:57
【问题描述】:

我之前使用插件创建了一些自定义结帐字段,它们的标记类似于:

<label for="billing_wcj_checkout_field_1"
     class="">Date</label><input type="text" class="input-text " 
    name="billing_wcj_checkout_field_1" id="billing_wcj_checkout_field_1" 
    placeholder=""  value="" display="date" />

但是,当我遵循文档并创建如下自定义字段时:

    woocommerce_form_field(
       'date', array(
           'type' => 'text',
           'class' =>array('form-row-first'),
           'label' => __('Date'),
           'required' => false
       ), $checkout->get_value( 'date' ));

我无法设置显示类型和输入类"hasDatepicker"

非常感谢任何帮助或指导。

【问题讨论】:

    标签: wordpress woocommerce


    【解决方案1】:

    您可以通过将此行添加到数组中来为输入添加类:'input_class' => array('hasDatepicker')

    woocommerce_form_field(
       'date', array(
           'type' => 'text',
           'class' =>array('form-row-first'),
           'label' => __('Date'),
           'required' => false,
           'input_class' => array('hasDatepicker')
       ), $checkout->get_value( 'date' ));
    

    【讨论】:

    • 'type' 这里应该是 'date'
    猜你喜欢
    • 2018-10-19
    • 2021-11-02
    • 2023-04-06
    • 2015-04-20
    • 1970-01-01
    • 2020-12-31
    • 1970-01-01
    • 2021-07-03
    • 2018-01-08
    相关资源
    最近更新 更多