Add shortcode to a template file

You can add WordPress shortcodes directly to template files by using the following snippet. Simply add the code below wherever you wish to display the shortcode’s content.

<?php echo do_shortcode("[shortcode]"); ?>

– LAST TESTED DECEMBER 9, 2019

Code not working? Let us know in the comments below.

Latest Snippets

Leave a comment