How to include WordPress shortcodes outside of the Loop or in a Template

Shortcodes are a great way to quickly add many different types of functions within pages or posts on your WordPress site. Many plugins and WordPress itself include shortcodes to access their functionality. You can also create your own shortcodes by writing your own plugins or adding to your themes functions.php. Now there are occasions when it is handy to include shortcodes in WordPress page/post templates or within WordPress theme files. You can quickly add a shortcode into any php file with the following code:

echo do_shortcode("[shortcode]");