Freelancer's Playground! New knowledges every now and then

24Jan/108

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"]' ); ?>

  • http://www.cichlidexplorer.com/ Cichlid

    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.

    • http://bayu.freelancer.web.id/ ariefbayu

      your welcome. Glad that helped!

  • http://www.cichlidexplorer.com Cichlid

    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.

    • http://bayu.freelancer.web.id/ Arief Bayu Purwanto

      your welcome. Glad that helped!

  • prefonty

    Thanks so much for thsi bit of code, exactly what I was looking for, you rock!

  • prefonty

    Thanks so much for thsi bit of code, exactly what I was looking for, you rock!

  • Joseph Dasilva

    Oh wow, thank you so much. You have no idea how much you helped me by posting this. I just spent 90 minutes fighting to integrate a regular CGI form script into my template (with no luck) and this just saved my day.

  • http://thoughtfaucet.com Gahlord

    You. Rock. Thanks!