How can I call a WordPress shortcode within a template? How can I call a WordPress shortcode within a template? wordpress wordpress

How can I call a WordPress shortcode within a template?


echo do_shortcode('[CONTACT-US-FORM]');

Use this in your template.

Look here for more: Do Shortcode


Try this:

<?php /*Template Name: [contact us]*/get_header();echo do_shortcode('[CONTACT-US-FORM]'); ?>


Make sure to enable the use of shortcodes in text widgets.

// To enable the use, add this in your *functions.php* file:add_filter( 'widget_text', 'do_shortcode' );// and then you can use it in any PHP file:  <?php echo do_shortcode('[YOUR-SHORTCODE-NAME/TAG]'); ?>

Check the documentation for more.