How to add a shortcode in WordPress PHP template file?
- This topic has 0 replies, 1 voice, and was last updated 2 years, 10 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Sometimes you might have to add a shortcode in WordPress PHP template file to accomplish certain functions.
Adding a shortcode directly to a WordPress template file will not work. We need to add the shortcode inside opening and closing PHP tags and invoke it with a special function as follows.
<?php echo do_shortcode('[name_of_shortcode]'); ?>