Aj Khandal

How to use Shortcodes in WordPress

There are 2 ways to use shortcode in WordPress –

1. In Editor – If we are calling shortcode in classic editor or any other page builder then we need to write code in brackets directly. Like

Example – [your shortcode goes here]

WordPress shortcodes

2. In template or PHP file – If we want to run shortcode in our template or any other place in our website then we need to use a WordPress pre-defined function that is do_shortcode.

Example – <?php echo do_shortcode( ‘[your shortcode goes here]’ ); ?>
 

 

For more on WP, check out this WordPress guide.

Do You Have An Interesting Project? ​

$10/ HR

Need Help?