wpcf7_contact_form_tag_func

The Contact Form 7 wpcf7 contact form tag func function.

Description

wpcf7_contact_form_tag_func( $atts, (constant) $content = null, (string) $code = '' ); 

Parameters (3)

0. $atts
The atts.
1. $content — Optional. (constant) => null
The content.
2. $code — Optional. (string) => ''
The code.

Usage

  1. if ( !function_exists( 'wpcf7_contact_form_tag_func' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/contact-form-functions.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // The content. 
  8. $content = null; 
  9.  
  10. // The code. 
  11. $code = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wpcf7_contact_form_tag_func($atts, $content, $code); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/contact-form-functions.php  
  1. function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { 
  2. if ( is_feed() ) { 
  3. return '[contact-form-7]'; 
  4.  
  5. if ( 'contact-form-7' == $code ) { 
  6. $atts = shortcode_atts( 
  7. array( 
  8. 'id' => 0,  
  9. 'title' => '',  
  10. 'html_id' => '',  
  11. 'html_name' => '',  
  12. 'html_class' => '',  
  13. 'output' => 'form',  
  14. ),  
  15. $atts, wpcf7 
  16. ); 
  17.  
  18. $id = (int) $atts['id']; 
  19. $title = trim( $atts['title'] ); 
  20.  
  21. if ( ! $contact_form = wpcf7_contact_form( $id ) ) { 
  22. $contact_form = wpcf7_get_contact_form_by_title( $title ); 
  23.  
  24. } else { 
  25. if ( is_string( $atts ) ) { 
  26. $atts = explode( ' ', $atts, 2 ); 
  27.  
  28. $id = (int) array_shift( $atts ); 
  29. $contact_form = wpcf7_get_contact_form_by_old_id( $id ); 
  30.  
  31. if ( ! $contact_form ) { 
  32. return '[contact-form-7 404 "Not Found"]'; 
  33.  
  34. return $contact_form->form_html( $atts );