Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################
- ### Paste in functions.php ###
- #############################
- /**
- * Custom message from Contact Form 7 for acceptance
- * @link https://pastebin.com/4nsdh9Fk
- * @see my_wpcf7_form_acceptance
- * @param $replaced
- * @param $submitted
- * @param $html
- * @param $mail_tag
- * @return string
- */
- function my_wpcf7_form_acceptance( $replaced, $submitted, $html, $mail_tag ) {
- $form_tag = $mail_tag->corresponding_form_tag();
- if ( ! $form_tag ) {
- return $replaced;
- }
- /** My translation */
- if ( ! empty( $submitted ) ) {
- $replaced = 'Checked';
- } else {
- $replaced = 'Not checked';
- }
- $content = empty( $form_tag->content )
- ? (string) reset( $form_tag->values )
- : $form_tag->content;
- if ( ! $html ) {
- $content = wp_strip_all_tags( $content );
- }
- $content = trim( $content );
- if ( $content ) {
- $replaced = sprintf( '%1$s: %2$s', $replaced, $content );
- }
- return $replaced;
- }
- add_filter( 'wpcf7_mail_tag_replaced_acceptance', 'my_wpcf7_form_acceptance', 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement