How to use WordPress shortcodes in theme files

To use a shortcode in a theme file, simply use the do_shortcode() function as shown below:

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

That’s it. Super simple, and really useful at times!

Leave a Reply

Your email address will not be published. Required fields are marked *