Content Editor Templates
To insert a template as a shortcode is also very easy. Click the insert template button at the top of the content editor:
Then select your template from the dropdown list. Then click on the shortcode tab. You will see the following:
You can choose to use caching by specifying a cache expiry in minutes, hours or days. This will prevent multiple calls to the database and improve the performance of your site.
You can also choose to insert the shortcode using the name of the template rather than the id. To do this, simply check ‘Rather use template name’. This helps with readability and makes it easier for you and your customers to see which template has been inserted into the content editor.
Why Use Shortcodes?
If you want to create a template that will be reused on multiple pages and is liekly to be updated, then it is recommended to use a shortcode.
For example, the ‘Get It Now’ button that is at the top of this page (and all the other documentation pages) is inserted via a template shortcode. The reason for this, is that the URL that the link points to is likely to change, and I do not want to remember which pages I included that HTML, and edit each page individually. So instead, I just goto the template and edit it in a single place, and the 10 places it is used throughout the site will be updated. It just makes sense!