Loading Contact-Form-7 Plugin Outside Post/Page/The_Loop

Hi, just want to share little snippet. I was developing wordpress site for my client and I want to use Contact-Form-7 (CF7) to speed-up my development time. I need to add form (custom form) outside the loop / post / page content. From CF7’s documentation, there’s no single text explaining how to do it.

So, I guess I have to get my hand dirty by crawling the code. Here’s how I do that.
From anywhere on wordpress theme files, put this code to display your CF7 form:

<?php echo do_shortcode ( '[contact-form 2 "Banquet Inquires"]' ); ?>

  • prefonty
    Thanks so much for thsi bit of code, exactly what I was looking for, you rock!
  • Thats exactly what I was looking for. I want to display a form in my category templates. Took me all afternoon to find this answer. Thank you.
  • your welcome. Glad that helped!
blog comments powered by Disqus