wpcf7_contact_form_tag_func()
Callback function for the contact-form-7 shortcode.
Хуки из функции
Возвращает
null
. Ничего (null).
Использование
wpcf7_contact_form_tag_func( $atts, $content, $code );
- $atts (обязательный)
- -
- $content **
- -
По умолчанию: null - $code **
- -
По умолчанию: ''
Код wpcf7_contact_form_tag_func() wpcf7 contact form tag func CF7 5.8.4
function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { if ( is_feed() ) { return '[contact-form-7]'; } if ( 'contact-form-7' === $code ) { $atts = shortcode_atts( array( 'id' => '', 'title' => '', 'html_id' => '', 'html_name' => '', 'html_title' => '', 'html_class' => '', 'output' => 'form', ), $atts, 'wpcf7' ); $id = trim( $atts['id'] ); $title = trim( $atts['title'] ); $contact_form = wpcf7_get_contact_form_by_hash( $id ); if ( ! $contact_form ) { $contact_form = wpcf7_contact_form( $id ); } if ( ! $contact_form ) { $contact_form = wpcf7_get_contact_form_by_title( $title ); } } else { if ( is_string( $atts ) ) { $atts = explode( ' ', $atts, 2 ); } $id = (int) array_shift( $atts ); $contact_form = wpcf7_get_contact_form_by_old_id( $id ); } if ( ! $contact_form ) { return sprintf( '<p class="wpcf7-contact-form-not-found"><strong>%1$s</strong> %2$s</p>', esc_html( __( 'Error:', 'contact-form-7' ) ), esc_html( __( "Contact form not found.", 'contact-form-7' ) ) ); } $callback = static function ( $contact_form, $atts ) { return $contact_form->form_html( $atts ); }; $output = wpcf7_switch_locale( $contact_form->locale(), $callback, $contact_form, $atts ); do_action( 'wpcf7_shortcode_callback', $contact_form, $atts ); return $output; }