Shortcodes within Theme Template Files or Widgets

How do I use shortcodes outside the post editor, such as in theme template files or widgets?

For theme or template files, use the function <?php echo do_shortcode('[[gcal]]'); ?> with the same attributes you’d use in the post editor.

Read this post for a simple way to use shortcodes in widgets.

If you use do_shortcode() or add shortcodes to widgets, you’ll need to explicitly enqueue the plugin’s styles and scripts as well.

See this code snippet for an example