I’m using Contact Form 7 on a website I’m building. Currently, Contact Form 7 uses shortcodes, meaning you can drop forms into posts.
Something like
1 |
[contact-form 1 "Sign up form"] |
You can’t use shortcodes in template files, because WordPress doesn’t parse them the same way it parses content.
WordPress, however, does have a function to parse shortcodes, where-ever you’d like.
1 |
< ?php do_shortcode( $content ) ?> |
If your short code needs to display content, then you just need to echo it.
1 |
< ?php echo do_shortcode('[contact-form 1 "Sign up form"]'); ?> |
Image Credit: seyed mostafa zamani
Comment or tweet @douglasradburn