Title: Contact Form 7 PHP Invocation Code?
Last modified: August 19, 2016

---

# Contact Form 7 PHP Invocation Code?

 *  [Greg Rickaby](https://wordpress.org/support/users/gregrickaby/)
 * (@gregrickaby)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/)
 * Hello. I am using Thesis, and would like to know if there is PHP invocation code
   so I can use Hooks rather than a text widget.
 * Example: instead of this: [contact-form 1 "Contact form 1"] is there: `<?php 
   contact_form(1) ?>` ???

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/page/2/?output_format=md)

 *  [Remon de Vries](https://wordpress.org/support/users/lemodesign/)
 * (@lemodesign)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166179)
 * I would love to find this out too so i can put this into a layout rather then
   using de text editor in wp.
 *  [devicbojan](https://wordpress.org/support/users/devicbojan/)
 * (@devicbojan)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166182)
 * You have it [here](http://www.skepo.info/web-development/contact-form-7-php-invocation-code/).
 *  [matrakkas](https://wordpress.org/support/users/matrakkas/)
 * (@matrakkas)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166186)
 * Hello!
 * I tried the code you highlighted in your website Devic, but it is not working
   for me.
 * I get the next error:
 * Fatal error: Call to a member function form_scan_shortcode() on a non-object 
   in /…/public_html/wp-content/plugins/contact-form-7/modules/file.php on line 
   63
 * Any idea?
 * Thanks in advanced
 *  [devicbojan](https://wordpress.org/support/users/devicbojan/)
 * (@devicbojan)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166188)
 * Sorry, I have tested this code only localy on XAMPP and it worked. You only need
   to add:
    global $wpcf7_contact_form; as first line of php code, I have updated
   [post](http://bit.ly/IjJ6Q) on my website.
 *  [semrocc](https://wordpress.org/support/users/semrocc/)
 * (@semrocc)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166195)
 * Unfortunately I have not been able to get this code working…just produces page
   errors in ie and stalls out when trying to submit the form.
 *  [Adam Harley (Kawauso)](https://wordpress.org/support/users/kawauso/)
 * (@kawauso)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166196)
 * Just use [`do_sortcode()`](http://codex.wordpress.org/Function_Reference/do_shortcode)?
 *  [semrocc](https://wordpress.org/support/users/semrocc/)
 * (@semrocc)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166197)
 * Thanks very much…that worked great 🙂
 *  [devicbojan](https://wordpress.org/support/users/devicbojan/)
 * (@devicbojan)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166199)
 * The code I’ve posted works on my site and in XAMPP just copy paste it. The do_shortcode()
   works to, I didn’t know about do_shortcode() function. Thank you Kawauso.
 *  [semrocc](https://wordpress.org/support/users/semrocc/)
 * (@semrocc)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166200)
 * I’m not sure why I couldn’t get your invocation code to work, but the do_shortcode()
   function seems to be something that probably won’t be affected by updates and
   newer versions, so probably a better option.
 *  [Kai2810](https://wordpress.org/support/users/kai2810/)
 * (@kai2810)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166201)
 * Hi guys, I think I’m having the same problem, trying to embed Contact Form 7 
   into my template php file.
 * semrocc, do you mind showing how you use the do_shortcode() function?
 * I’m a noob in php…
 *  [devicbojan](https://wordpress.org/support/users/devicbojan/)
 * (@devicbojan)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166202)
 * Just change the number and name of the contact form
 * <?php echo do_shortcode(“[contact-form 1 'Contact form 1']“); ?>
 *  [semrocc](https://wordpress.org/support/users/semrocc/)
 * (@semrocc)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166203)
 * Yes…exactly as above…thanks
 *  [Designs Genius](https://wordpress.org/support/users/sebyrar/)
 * (@sebyrar)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166205)
 * A useful “Invocation code” ! Thanx for the “do_shortcode” I needed !
 *  [dplatt](https://wordpress.org/support/users/dplatt/)
 * (@dplatt)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166206)
 * Thank you semrocc and devicbojan the do shortcode is what I needed too!
 *  [alanlongmore](https://wordpress.org/support/users/alanlongmore/)
 * (@alanlongmore)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/#post-1166207)
 * Thank you for this

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/page/2/?output_format=md)

The topic ‘Contact Form 7 PHP Invocation Code?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 10 participants
 * Last reply from: [Kai2810](https://wordpress.org/support/users/kai2810/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/contact-form-7-php-invocation-code/page/2/#post-1166208)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
