How Can We Help?
You are here:
< Back

A shortcode as its name implies is a short code tag that can be used in the backend (i.e. Page/Post editor), allowing it to be replaced with a much larger block of code in the frontend. In other words, you can represent an entire ECM code block as a shortcode in your Page or Post editor window.

It is an ideal solution for a number of reasons. It provides targeted placement of your code within your page content, and it saves you from the bad practise of adding your code directly to your Page/Post editor, which can have the undesirable habit of removing certain tags.

How it works

Each time you create a new Easy Code Manager code block, a shortcode of the same name is automatically created. Code blocks can be delegated by using the [ecm] shortcode tag and specifying the code block name or id. Since the code block ID may be a little hard to remember and may break when moving your site data to another host, it’s recommended to always use the code block name. You can find your code block name and ID in the Information Panel.

1) Delegate code block by name:

[ecm name='My Code Block']

2) Delegate code block by id:

[ecm id='42']

Adding shortcodes
You can go into the Information Panel and copy and paste this into your Page or Post editor. In the premium PLUS version, we include a TinyMCE button, which lists all your code block shortcodes for easy insertion via a single click.
Note: If your shortcode is being used to replace itself with the code from your code block, it can be used as a self-closing tag (i.e. no closing tag). Generally, you do not need to include the shortcode closing tag, but it will still work just fine if it is included.

Duplication – NEED TO TEST THIS!!!
Another parameter that shortcodes support, is the force parameter. For example, if a code block is already being assigned to a selected page using the Assignment Panel, then it cannot be duplicated by using a shortcode in the page as well. That is, unless the force parameter is set to true. This parameter, which is set to false by default can be used in the following way:

[ecm name='My Code Block' force='true']

This forces the code block to be executed via shortcode even if it’s being assigned to the same request.

Table of Contents