How do I insert the Contact Form 7 shortcode into a php file?

To insert a form, you need to use:

[contact-form-7 id="179" title="Консультация"]

I copy the shortcode of this form and paste it to the main page in the file front-page.php

The form is output via the content, but when I insert it into the php code, it is not output.

Who faced the same problem here is the code-solution:

<?php echo do_shortcode('[contact-form-7 id="179" title="Консультация"]'); ?>
Author: WP Punk, 2017-07-06

1 answers

This way the form will not work. In the php file, you need to insert

echo do_shortcode('[contact-form-7 id="179" title="Консультация"]');
 6
Author: KAGG Design, 2017-07-06 13:42:28