• Hello,

    I would like to know if it is possible to insert a formualire of contact on a page php.

    Situation: When a user types a therm in the search bar and there is no result a page is displayed (content-no.php), I would like on this page displayed a suggestion form.

    How to do ?

    I tried to put the shortcode but it does not work!

    Looking forward to your return,

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter anthony750

    (@anthony750)

    Hello,

    I still have not got an answer to my topic.

    Regards,

    You need to first figure out where in that PHP file’s code you want to enter the shortcode. I cannot help you with that but I can help you with the shortcode coding.

    Once you have figured where the shortcode should go, insert your shortcode into your PHP file’s PHP code using the “do_shortcode” function, like this…

    <?php echo do_shortcode( '[caldera_form id="CFXXXXXXXXXXX"]' ); ?>

    This is the same with just about any shortcode, not just Caldera Forms shortcodes. It’s a good thing to know.

    You may or may not need to use the <?php and the ?> at the beginning and end of this string, but that depends on where you need to place it in the files coding.

    Trial and error is how you’ll find out where the code should go if you’re not sure. Make sure you backup the original file in case you get in too deep. This way you can just reupload the original file and start over if you mess up too many times that you get in too deep.

    Oh, one more bit of advice. For some reason the “do_shortcode” function won’t work in some themes unless you switch around the single and double quotes. So if you try the code above and you just can’t get it to work in your theme, as a last ditch effort, use this code and see if it works…

    <?php echo do_shortcode( "[caldera_form id='CFXXXXXXXXXXX']" ); ?>

    See the difference? The outside is double quoted and the form ID is single quoted, complete opposite. Sometimes you have to do that to get it to work. It’s rare, though.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Inserted form in a php page’ is closed to new replies.