Skip to content

Instantly share code, notes, and snippets.

@tiendungdev
Forked from jbutko/index.php
Created April 5, 2018 05:20
Show Gist options
  • Save tiendungdev/b383367747d9c1d7e3f5199c5bf5e07f to your computer and use it in GitHub Desktop.
Save tiendungdev/b383367747d9c1d7e3f5199c5bf5e07f to your computer and use it in GitHub Desktop.
PHP, WP, Contact Form 7: Echo Contact Form 7 form if it is installed (if function_exists)
<?php
if (function_exists('wpcf7')) {
echo do_shortcode( '[contact-form-7 id="413" title="Contact form 1"]' );
} else {
echo "<p class='title'>Please install <a href='http://wordpress.org/plugins/contact-form-7/' rel='nofollow'>Contact Form 7</a> plugin and build some contact form. Then use your shortcode on the contact page.</p>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment