WordPress Tutorial: add QuickTag in the TinyMCE editor and comment box

Source: Internet
Author: User

The following describes two simple methods to enable the TinyMCE editor and QuickTag in the front-end frame. All calls are WordPress's built-in QuickTag.

Use AddQuicktag plug-in to enhance the TinyMCE editor

AddQuicktag is an enhanced plugin for the built-in TinyMCE editor of WordPress. It allows you to add custom buttons quickly. You only need to simply add the desired shortcut button, so you don't have to worry about the inconvenience caused by changing the subject. Supports visual mode and Html editing mode. Backup and recovery are also supported!

1. Search AddQuicktag on the background plug-in installation page to install the plug-in online.

2. After the plug-in is enabled, set it in the background? AddQuicktag allows you to go to the settings page and add corresponding shortcut buttons as needed.

In addition, I have posted an article about adding custom buttons to the WordPress built-in TinyMCE editor. The above details how to add QuickTag without using plug-ins. For more information, see.

Use the code to add QuickTag to the comment box

1. Create a file in the topic directory: my_quicktags.js. The content is as follows:

// Set quicktagsquicktags ({id: "comment", // The ID of the comment box, usually comment. Set buttons: "strong, em, del, link, code "// you can choose one based on your needs: strong, em, link, block, del, ins, img, ul, ol, li, code, more, spell, close}); // the default reference (block) insertion is very painful, so you have defined a QTags. addButton ('quote', 'quote', ',', 'quote'); // It defines an underscore. addButton ('u', 'u', '','', 'u ');


2. Load the jQuery library and js file, and add the following code to the topic file functions. php:

If (comments_open () & is_singular () {function zfunc_print_script () {wp_enqueue_script ('jquery '); // load the jquery library wp_enqueue_script ('quicktags '); // load js quicktagswp_enqueue_script ('My _ quicktags', get_template_directory_uri (). '/my_quicktags.js', array ('My _ quicktags', 'jquery '), '1. 0', 1, true); // load the my_quicktags.js file created in step 1} add_action ('WP _ enqueue_scripts ', 'zfunc _ print_script ');}

In this case, the figure is as follows:


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.