Add support for standalone shortcodes

Created on 29 April 2015, over 9 years ago
Updated 16 June 2023, over 1 year ago

I'm working on a project where we need to implement shortcodes with a syntax that is incompatible with the WordPress style shortcodes; no closing tag and no trailing slash. Some examples:

[ITALIC "text"]
[BR]
[LINK "http://example.com" "link text"]

The result:

function MODULE_shortcode_info() {
  $shortcodes['ITALIC'] = array(
    'title' => t('Italic'),
    'description' => t('Italicize the given text.'),
    'process callback' => 'MODULE_shortcode_italic',
    'standalone' => TRUE,
  );

  return $shortcodes;
}

function MODULE_shortcode_italic($attrs, $text) {
  return '<em>' . $attrs[0] . '</em>';
}
✨ Feature request
Status

Postponed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States FluxSauce

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024