How do I get Drupal to use Wordpress-style editing code?

Source: Internet
Author: User
Tags drupal

If you've ever had the experience of migrating a Wordpress site to Drupal, it's likely that the first thing customers will ask is how to add editing code to Drupal.

The Shortcodes plugin in Wordpress allows the user to add various editing code to the content, and then the code will be converted to the corresponding content when displayed, thus saving some editing work. For example, to embed a photo album in Wordpress into the content, simply add the edit code by pressing [gallery id= "123" size= "medium" format, which is automatically converted to the corresponding album when it is displayed.

In Drupal, a similar function can be achieved with the help of the Shortcode module. The Shortcode module in Drupal is not a shortcodes plugin for porting Wordpress, just a very similar function. But if the client uses the Shortcodes plugin in WordPress, it will not feel too uncomfortable in Drupal.

The text will show you how to configure and use the Shortcode module in Drupal.

Preparatory work

The preparation for installing the Shortcode module is very simple, just download and enable the Shortcode and Shortcode Basic Tags sub-modules.

If you use Drush, you can quickly download and enable these two modules using the following two lines of command.

drush dl shortcode
drush dl shortcode shortcode_basic_tags

Using the underlying tags (basic tags)

The Shortcode core module itself does not provide any available editing code, but rather provides a set of API interfaces that can be used by other modules. Therefore, you must enable the Shortcode submodule (shortcode Basic Tags or Shortcode Video Macro) to start using the Edit Code feature. Where Shortcode Basic Tags is the most used sub-module, it provides a series of common editing code, such as [img], [link], [button] and so on.

Now let's configure this module so that you can use [img], [link], [button] in the editor three kinds of editing code.

First verify that the Shortcode Basic Tags submodule is enabled, access the input Format Configuration page, and configure the Filtered HTML. In the Enable Filters option, check shortcodes and click Save

Once the Shortcode filter is enabled, edit the input format again and locate the configuration panel below to select Shortcode for further configuration, such as enabling the editing of pictures, links, and buttons.

Save the settings after adjusting the order of the filters as needed.

With the filter configured, we'll see how the Shortcode works.

Click Add Content, fill in the title and fill in the following code into the content area (e.g.).

[button path="node/2" (class="additional class")]Order now[/button]

[img src="misc/druplicon.png" (class="additional class"|alt="alt text")/]

[link path="node/2"]link text[/link]

The instructions for editing the code can be found in the help information in the input format, so there is no need to deliberately memorize the available editing code. You can refer to these when you are not sure how to write the code for editing.

After saving the sample code above, you can see in the new page that the editing code you just entered has been converted to the corresponding button, picture, and link.

Original title: How do I get Drupal to use Wordpress-style editing code?

Original link: http://drupalct.org/drupal-site-building/using-wordpress-style-shortcode-in-drupal.html

How do I get Drupal to use Wordpress-style editing code?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.