Shortcode
Any shortcode from WordPress or a plugin. Type it, click Apply, and see what it shows.
Use this element#
Available in Kindly Edit 0.9.16 and later.
Shortcode shows anything a WordPress shortcode draws: a form from a forms plugin, a gallery, a booking calendar, a donation button. Add Shortcode, type the shortcode as you would in WordPress's own editor, then click Apply (or press Enter). The page shows what the shortcode displays straight away.
[contact-form-7 id="12" title="Contact"]
The brackets are optional. Each Shortcode element holds one shortcode.
Availability#
Shortcode is one of the main elements. In Developer mode it is an everyday tile in Add and sits under Basic in the Elements panel. In Simple mode it is with the basics.
Administrators and editors can add a Shortcode element and change its shortcode. Authors, contributors and other accounts don't see it in the add menus. They can still keep or delete a shortcode that is already on a page, and change everything around it. For them the field is read-only and says "Only administrators and editors can change it." Kindly Edit's AI never adds or changes one, and a template that holds one can only be saved by someone who may add shortcodes.
Content controls#
Shortcode#
The field shows the current shortcode in brackets. Type a new one and click Apply or press Enter. Apply is one Undo step.
When Apply can't show it, the element says why:
- This site has no [name] shortcode. Check the spelling, or turn on the plugin that adds it. A shortcode whose plugin is off is kept on the page but shows nothing to visitors.
- Type one shortcode, like [gallery]. The field holds something that isn't a single shortcode, such as two shortcodes or an enclosing one (
[name]words[/name]).
Save and check#
- Click Apply and check what the element shows.
- Use Undo and Redo to check the change is reversible.
- Save a draft, reopen it, and confirm the shortcode and its output remain.
- Check the page at desktop and phone widths. Shortcode output brings its own design from the plugin that makes it.
- Publish when it is ready, then open the public page. Some shortcodes load scripts (a slider, a form's checks) that start only on a fresh page load, so check those on the published page.
On the public page, Kindly Edit gives a form field without a label a plain name for screen readers, from its placeholder or name. It also requires the email address in a sign-up form whose only field is that address (tick boxes aside), in case the plugin forgot to. An email field in a larger form keeps the plugin's own choice, so an optional or second address stays optional (0.9.18 and later).
How it is stored#
The block comes from blocks/215-shortcode.html. The page stores only the shortcode, never its output:
<div class="ke-shortcode" data-ce-shortcode="contact-form-7 id="12""></div>
On the way out, WordPress runs the shortcode and fills the element, so visitors always get its current output, without the marker attribute. The editor empties the element again before a save. Use WordPress editor turns it back into the shortcode as text.
A shortcode registered as live content keeps that source's declared options. Any other shortcode runs exactly as typed when the site has it.
For developers: cantata_edit_shortcode_can_author (default: the unfiltered_html capability) decides who may write one, and cantata_edit_shortcode_allowed returning false keeps a shortcode from running anywhere. A save that adds or changes one without permission is refused with cantata_edit_protected_shortcode (403).