【发布时间】:2021-05-02 09:49:43
【问题描述】:
我想删除结帐表单字段中的额外 html。例如,我想在结帐字段中删除 'woocommerce-input-wrapper span 和 P 标记。
我已尝试使用钩子删除woocommerce-input-wrapper,但此跨度标记未在 checkfout 字段中删除。
我在我的活动主题中的functions.php中使用了以下脚本。
add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields)
{
unset($fields['billing']['billing_address_2']);
//echo "<pre>";print_r($fields);
$fields['billing']['billing_email'] = array(
'label' => '',
//'input_wrapper' =>'fdsf',
'placeholder' => _x('email', 'placeholder', 'woocommerce'),
'input_class' => array("form-control"),
'class' => array('form-group'),
'priority' => 4
);
//$fields['billing']['billing_email']['placeholder'] = 'Email Address ';
$fields['billing']['billing_company']['placeholder'] = 'Business Name';
$fields['billing']['billing_company']['label'] = 'Business Name';
$fields['billing']['billing_first_name']['placeholder'] = 'First Name';
$fields['shipping']['shipping_first_name']['placeholder'] = 'First Name';
$fields['shipping']['shipping_last_name']['placeholder'] = 'Last Name';
$fields['shipping']['shipping_company']['placeholder'] = 'Company Name';
$fields['billing']['billing_last_name']['placeholder'] = 'Last Name';
$fields['billing']['billing_phone']['placeholder'] = 'Phone ';
return $fields;
}
谁能帮我删除结帐表单字段中的跨度标签,我对 woocommerce 不太了解,所以请帮助我如何删除跨度标签。
【问题讨论】:
-
我试过了,但我不知道如何实现这个,你能给我一个归档的例子,这样我就可以做到。
-
我已经在我的代码中解释了我需要什么,并且我已经尝试了动作挂钩来删除你需要的其他代码。我也是一名开发人员。
标签: php wordpress woocommerce hook-woocommerce