WordPress tip: Use shortcodes in theme files

Assuming the want to use a shortcode named [my_shortcode], you’ll have to do the following and use the do_shortcode() function:

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

Easy and super useful.

Thanks to WP Snippets for the tip!

Leave a Reply

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