How to Use WordPress Style Shortcodes in Drupal 7
If you've ever had to migrate a client from WordPress to Drupal, one of the first things they'll ask for is how to add shortcodes in Drupal.
Shortcodes in WordPress are macros that you can drop into content and have it render an object. For example, if you want to embed a gallery in WordPress you simply add [gallery id="123" size="medium"]
into the content and when a post is displayed a gallery is rendered.
Implementing similar functionality in Drupal is very easy thanks to the Shortcode module. The module is not an exact copy of the Shortcode API but implements very similar functionality. If your clients are use to shortcodes in WordPress then they'll feel right at home using them in Drupal.
In this tutorial, you'll learn how to configure and use the Shortcode module in Drupal.
Now, you may be thinking to yourself, can't Token do this? The short answer is yes. You can implement similar functionality using Token Filter. The module implements a custom filter which can be added to text formats. If you add [site:name]
into the body, it'll render the site name.