Shortcode in a WordPress Template

Oct 01, 2013

Shortcodes in WordPress are bits of text you can use in the content area to invoke some kind of function to accomplish certain tasks. You can write your own shortcodes, and plugins often offer their functionality via shortcodes as well.But what if you want to use a shortcode from within a template instead of with the content of a Post/Page? You can invoke it with a special function:

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

No comments

Leave a Reply

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