Shortcodes were introduced back in WordPress 2.5. Shortcodes are for creating macros to be use in a posts. For instance, the following shortcode (in the post/page content) would add a photo gallery into the page:
[ gallery ]
If you want to use that shortcode outside of the WordPress post or page editor or PHP templates , you can use this snippet to output from the shortcode’s handler(s):
// Use shortcode in a PHP file (outside the post editor). echo do_shortcode('[ gallery ]');
sources: WordPress codex
Leave a Reply