mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-02 12:02:25 +08:00
https://stackoverflow.com/questions/64127855/put-a-span-tag-inside-specific-woocommerce-checkout-field-wrapper-html-tag
8 lines
417 B
Text
8 lines
417 B
Text
add_filter( 'woocommerce_form_field', 'wc_span_tag_inside_checkout_input_fields', 10, 4);
|
|
function wc_span_tag_inside_checkout_input_fields ( $field, $key, $args, $value ) {
|
|
// Wrap all fields except first and last name.
|
|
if ( $key === 'shipping_city' ) {
|
|
$field = str_replace( array('<label ', '</span>'), array('<span class="special"><label ', '</span></span>'), $field );
|
|
}
|
|
return $field;
|
|
}
|