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' => 0, 'title' => '', 'html_id' => '', 'html_name' => '', 'html_class' => '', 'output' => 'form'), $atts); $id = (int) $atts['id']; $title = trim($atts['title']); if (!($contact_form = wpcf7_contact_form($id))) { $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 '[contact-form-7 404 "Not Found"]'; } return $contact_form->form_html($atts); }
function wpcf7_contact_form_tag_func($atts, $content = null, $code = '') { global $wpcf7, $wpcf7_contact_form; if (is_feed()) { return '[contact-form-7]'; } if ('contact-form-7' == $code) { $atts = shortcode_atts(array('id' => 0, 'title' => ''), $atts); $id = (int) $atts['id']; $title = trim($atts['title']); if (!($wpcf7_contact_form = wpcf7_contact_form($id))) { $wpcf7_contact_form = wpcf7_get_contact_form_by_title($title); } } else { if (is_string($atts)) { $atts = explode(' ', $atts, 2); } $id = (int) array_shift($atts); $wpcf7_contact_form = wpcf7_get_contact_form_by_old_id($id); } if (!$wpcf7_contact_form) { return '[contact-form-7 404 "Not Found"]'; } if ($wpcf7->processing_within) { // Inside post content or text widget $wpcf7->unit_count += 1; $unit_count = $wpcf7->unit_count; $processing_within = $wpcf7->processing_within; } else { // Inside template if (!isset($wpcf7->global_unit_count)) { $wpcf7->global_unit_count = 0; } $wpcf7->global_unit_count += 1; $unit_count = 1; $processing_within = 't' . $wpcf7->global_unit_count; } $unit_tag = 'wpcf7-f' . $wpcf7_contact_form->id . '-' . $processing_within . '-o' . $unit_count; $wpcf7_contact_form->unit_tag = $unit_tag; $form = $wpcf7_contact_form->form_html(); $wpcf7_contact_form = null; return $form; }