Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Shortcode

Security covered Under active development 10,980 sites

Part of the Shortcode ecosystem · 4 projects

This module provides an API for creating and managing text formatting macros called "shortcodes." It allows users to insert pre-defined shortcodes into content to easily format text, display images, create buttons, embed videos, and more. Additional shortcodes can be provided by other modules.

Shortcodes are macros you place directly in the text of your content. Each macro is expanded and formatted through Drupal's theme layer when the content is displayed - similar in spirit to WordPress-style shortcodes, but reworked to fit Drupal's API conventions.

Shortcode is a small API module: a text format filter plus a plugin type for defining shortcode tags. Any module can supply new tags - including this one, via the bundled Basic Tags submodule below. Every tag is themeable, and tags can be nested inside each other (including inside another instance of the same tag) with no special recursion handling required.

As of 3.0.0, the module has been rewritten for Drupal 11.1+ and 12: object-oriented #[Hook] implementations, PHP-attribute-based plugin discovery (existing annotation-based plugins keep working), constructor-injected services, full type coverage, and automated unit + functional test coverage. If you maintain your own shortcode plugins, see UPGRADING.md in the module for the breaking changes in this release.

Macros come with this module

Shortcode basic tags module

  • [quote] Replace the given text formatted like as a quote.
  • [img] Show an image.
  • [highlight] Insert a span with highlight css class around the text.
  • [button] Insert a link formatted like as a button.
  • [dropcap] Replace the given text formatted like as a dropcap.
  • [item] Insert div or span around the text with some css classes.'
  • [clear] Insert a float-clearing div for a proper layout.
  • [link] Makes an aliased link to the given path.

Shortcode modules

Plans

* separate macros module from the API
* remove input filter dependency - push this functionality to a separate module
* tests
* D8 version - The planned release date of the beta version is 4. Jan 2016.

Docs, tutorials

* Nice tutorial by Ivan Zugec: How to Use WordPress Style Shortcodes in Drupal 7
* Boost your WYSIWYG with Shortcode module by salva.
* Shortcodes in Drupal? Yes you can! by Brianna Deleasa.

Sponsorship

...have a feature you'd like to sponsor? Or just want to sponsor this project? Get in touch!

Warning!

* Since 7.x-2.21 the Shortcode Video module moved to a separated project.
* Since 7.x-2.1 the Shortcode for wysiwyg module moved to a separated project.

Drupal 11 · not 10

Ask your assistant about Shortcode

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • filter Drupal core

Required by

3 tracked projects depend on this one

More in the Shortcode ecosystem

Most installed first

All 4 →

Activity

Tracked releases
5
Tracked since
Jul 2023
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
3.0.0 Stable 11 Sep 7, 2026
3.0.x-dev Dev 9–11 Sep 3, 2026
2.0.4 Stable 9–11 Sep 3, 2026
2.0.3 Stable 9–11 Jul 29, 2024
2.0.2 Stable 9–10 Jul 22, 2023