I have tried but it doesn't work.
remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit', 20 );<br>
add_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit_button' );
function wpcf7_add_shortcode_submit_button() {
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_button_shortcode_handler' );
}
function wpcf7_submit_button_shortcode_handler( $tag ) {
$tag = new WPCF7_Shortcode( $tag );
$class = wpcf7_form_controls_class( $tag->type );
$atts = array();
$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
if ( empty( $value ) )
$value = __( 'Send', 'contact-form-7' );
$atts['type'] = 'submit';
$atts = wpcf7_format`enter code here`_atts( $atts );
$html = sprintf( '<button %1$s>%2$s</button>', $atts, $value );
enter code here
return $html;
}
You can achieve this with easier way - jQuery:
add_action('wp_footer',function(){
echo '<script>
jQuery(\'.wpcf7-form [type="submit"]\').attr("type","button");
</script>';
}, 9999);
If you want to replace that input with custom button element, then you can do so
add_action('wp_footer',function(){
echo '<script>
jQuery(\'.wpcf7-form [type="submit"]\').hide();
jQuery(\'<button type="submit>BUTTON</button>"\').insertAfter(jQuery(\'.wpcf7-form [type="submit"]\'));
</script>';
}, 9999);
you can place this code in functions.php
remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_submit' );
add_action( 'wpcf7_init', 'new_wpcf7_add_shortcode_submit_button',20 );
function new_wpcf7_add_shortcode_submit_button() {
wpcf7_add_shortcode( 'submit', 'new_wpcf7_submit_button_shortcode_handler' );
}
function new_wpcf7_submit_button_shortcode_handler( $tag ) {
......
}