Here’s a handy tip from the codex. If you want to use a shortcode outside of the WordPress post or page editor, you can use this snippet to output from the shortcode’s handler(s):
1 2 |
// Use shortcode in a PHP file (outside the post editor).
<?php echo do_shortcode(''); ?>
|
Replace with the shortcode you want to use. More information is available in the WordPress codex on the do_shortcode function page.
Thanks! Searched and found. :)
Hey,
Thanks for this tip! Any idea how to activate a hardcoded shortcode (in the template) via a custom field on a per post basis..:?
Cheers,
Thomas.
Thank you very much!
Great work Sara, you resolved my problem with a plugin that I have.