Skip to content

Instantly share code, notes, and snippets.

Hướng Dẫn Thêm Icon Vào Button Contact Form 7
remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_submit', 10, 0 );
add_action( 'wpcf7_init', 'shw_custom_submit_cf7', 10, 0 );
function shw_custom_submit_cf7() {
wpcf7_add_form_tag( 'submit', 'shw_custom_submit_cf7_handlers' );
}
function shw_custom_submit_cf7_handlers( $tag ) {
$class = wpcf7_form_controls_class( $tag->type, 'has-spinner' );
$atts = array();
$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
// if ( empty( $value ) ) {
// $value = __( 'Send', 'contact-form-7' );
// }
$atts['type'] = 'submit';
//$atts['value'] = $value;
$atts = wpcf7_format_atts( $atts );
$html = sprintf( '<button type="submit" %1$s class="wpcf7-form-control has-spinner wpcf7-submit">'.html_entity_decode($value).'</button>', $atts );
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment