WordPress shortcodes are a way to insert content into your WordPress site that would otherwise be difficult or impossible to do. These shortcodes can be used for a variety of things, such as inserting the latest tweets from your Twitter account, embedding videos from YouTube, and inserting maps.
The format for adding shortcodes in WordPress is as follows:
[shortcode]
For example, this would be how you would add an image with the shortcode
Generally we use WordPress shortcode with the content of a Post or Page. But what if you want to use WordPress shortcode from within a template, you can not use ‘[shortcode]’ in the template.
In order to insert a shortcode, start by wrapping the standard WordPress do_shortcode function with a little PHP code as follows:
<?php echo do_shortcode("[shortcode]"); ?>