How to Use a WordPress Shortcode Outside of the Post Editor

How to Use a WordPress Shortcode Outside of the Post Editor

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):

// Use shortcode in a PHP file (outside the post editor).
<?php echo do_shortcode('
[shortcode]
'); ?>

Replace

[shortcode]

with the shortcode you want to use. More information is available in the WordPress codex on the do_shortcode function page.

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: