AWB Collier
Member
Posted 4 months ago #
Hello,
I have the WP plugin as my site is build on the WP platform. Is there a way to manually add the contact form where I want it to appear instead of within a post or page? I am looking to add it to my footer PHP file which has now 'content' to be able to add the form. Is this possible?
Thank you in advance,
http://wordpress.org/extend/plugins/si-contact-form/
How can I add the contact form to a WordPress template manually rather than use shortcode in a page?
Use this code:
<?php
if ( isset($si_contact_form) ) {
echo $si_contact_form->si_contact_form_short_code( array( 'form' => '1' ) );
}
?>
Be sure to set the correct form number for example, for form 2 you have to set: 'form' =>'2'
This may work also:
<php? echo do_shortcode('[si-contact-form form="1"]'); ?>
If it is a non WordPress PHP site you can use the Fast Secure Contact Form PHP version
AWB Collier
Member
Posted 4 months ago #
Hello,
Thanks for the quick response! I have tried both code snipets and it wont work. My form does load (it is #1) when I place the standard code in the page and publish it, it just wont work in the template. Is there something I am missing, or else I need to do?
Thanks in advance,
Change the #1 to the number of the form you want.
You might try contacting your theme author for support trying to get code working in it.
AWB Collier
Member
Posted 4 months ago #
Hi, I got it to work. It wasn't the wrong number. The trick was to make the php think it was working in the content of a post/page as a filter. This is what worked:
<?php echo apply_filters('the_content','[si-contact-form form="1"]');?>
Thanks!