• Hi

    I am looking got change the output HTML of some of the elements, especially response and checkbox

    for example the function wpcf7_checkbox_form_tag_handler I want to change the output of the item

    $item = sprintf('<input %2$s /><span class="wpcf7-list-item-label">%1$s</span>', esc_html( $label ), $item_atts)

    to

    $item = sprintf('<input %2$s class="form-check-input" /><label class="wpcf7-list-item-label" class="form-check-label">%1$s</label>', esc_html( $label ), $item_atts)

    Is this possible with str_replace? I have tried but cannot get it to work.

    I would also like to add an id=”” to the input and a for=”” to the label but I expect that to be harder.

    With the response output I want to add a close button and I have tried this code

    add_filter( 'wpcf7-response-output', 'wpcf7_custom_reponse_html', 99, 1 );
    function wpcf7_custom_reponse_html( $html ) {
    	$html = str_replace( '<div %1$s>%2$s</div>', '<div %1$s>%2$s<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>', $html );
    	return $html;
    }

    But this does not work.

    Is there any way to edit the output HTML of COntact Form 7?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Change output HTML’ is closed to new replies.