在WooCommerce中创建自定义字段时,如何在单行中排列单选按钮选项?

时间:2019-01-11 08:20:39

标签: wordpress woocommerce

我要在我的Wordpress Checkout页面上添加一个自定义字段。自定义字段是带有2个选项的单选按钮类型。

我正在尝试将这两个选项排列在同一行上,这没有发生。

function custom_override_checkout_fields( $checkout ){

    woocommerce_form_field( 'contactmethod', array(
    'type'          => 'radio', 
    'required'  => true, 
    'class'         => array('form-row-wide'), 
    'label'         => 'Preferred Shipping method',
    'clear'     => true,
    'options'   => array( 
    'pickup'    => 'Pickup', 'delivery' => 'Delivery'// 'value'=>'Name')
    ), $checkout->get_value( 'contactmethod' ) );
}


<p class="form-row form-row-wide validate-required" id="contactmethod_field" data-priority="">
<label for="pickup" class="">Preferred Shipping method&nbsp;<abbr class="required" title="required">*</abbr></label>
    <span class="woocommerce-input-wrapper">
        <input type="radio" class="input-radio " value="pickup" name="contactmethod"  id="contactmethod_pickup" />
        <label for="contactmethod_pickup" class="radio ">Pickup</label>
        <input type="radio" class="input-radio " value="delivery" name="contactmethod"  id="contactmethod_delivery" />
        <label for="contactmethod_delivery" class="radio ">Delivery</label>
    </span>
</p>

0 个答案:

没有答案