Implement the default editor enhancements to WordPress without using Plug-ins

Source: Internet
Author: User
Keywords Features WordPress

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Many people do not see the WordPress editor, because the available features are very little pathetic. As little Jane often wants to insert various code in the article, in the previous little Jane has been using the editor enhancements "CK and Syntaxhighlighter" This editor is very powerful, but later found that the display of code highlighting and small Jane used template seriously inconsistent! Because the little Jane blog did a copy-proof, Cause the page code can not copy, small Jane need a plug-in to implement code highlighting and support replication!

Later, after a little Jane Baidu and continue to Google two next. Hey, finally found a small Jane satisfied with the code highlighting Plug-ins and can also copy the code! found the plug-in, so the installation enabled, a look, small Jane immediately cup, this plug-in plus CK and Syntaxhighlighter editor Plug-ins, two use, unexpectedly there is a conflict, Write the code is a lot of garbled! Testing the code highlighted by the plugin can only be used in the default editor! That is, I have to uninstall the CK and Syntaxhighlighter editor plug-ins before I can use it! T-t

Jane is Born to love the life, this problem must be solved!

Now in front of Jane's problem is that you want to use the editor plug-in, you can not use the code highlighting Plug-ins, but I need two ah, this two-choice problem is really a headache ah, we must find a solution to the two worlds!

Looking for no fruit! Little Jane had no intention of looking at the official WordPress API function. Heaven Has eyes!! Originally, the editor in the background can insert a lot of enhancements! Little Jane decisively uninstall the CK and Syntaxhighlighter Editor plugin! In fact, the WordPress editor is very powerful and contains almost all the editor buttons. Only the default function of the program is relatively little just acridine!

Xiao Jane immediately for their own WordPress default editor added a common practical function to do the test, the effect is really very good acridine. Haha, look at the picture!

  

Is it not the same simple editor as the default? The last line of functionality is a small simple code plus. The default editor for these features is not! It's just that we need to pull them up and add to it, and begin to find a lot of time for this--and finally found the way to be super simple!

Find the template function file (that is, functions.php) of the topic you are using, and add the following code:

Enhanced editor start function add_editor_buttons ($buttons) {$buttons [] = ' fontselect '; $buttons [] = ' fontsizeselect '; $buttons [] = ' Cleanup '; $buttons [] = ' styleselect '; $buttons [] = ' hr '; $buttons [] = ' del '; $buttons [] = ' Sub '; $buttons [] = ' sup '; $buttons [] = ' copy '; $buttons [] = ' paste '; $buttons [] = ' cut '; $buttons [] = ' undo '; $buttons [] = ' image '; $buttons [] = ' anchor '; $buttons [] = ' BackColor '; $buttons [] = ' wp_page '; $buttons [] = ' charmap '; return $buttons; } add_filter ("Mce_buttons_3", "add_editor_buttons"); Enhanced Editor End

Save it! Haha, small simple article to enable anti-duplication, the code on the page is not copied, but you can click on the top right corner of the "View Source Code" button, in the pop-up window to copy!

  

  

Finally, attach the key to the button call, that is to say, the following features can be added to the editor, Haha, strong enough! The following function buttons can be added, you add more versatility when you just put the code "$buttons [] =" The words in the following single quotes are replaced by the keys listed in the parentheses below. Still in the tangle of WordPress with editor features less friends, go and try it!

  

Key called by the WordPress Editor Button:

Cut (copy) paste (paste) undo (undo) Redo (Redo) Center (justifycenter) Bold (bold) italic (italic) align (justifyleft) right (Justfyright) Align (justfyfull) Insert Hyperlink (link) to remove hyperlink (unlink) Insert Picture (image) Clear Formatting (Removeformat) underline (underline) strikethrough (strikethrough) anchor text ( Anchor) new text (newdocument) font color (forecolor) Font background color (BackColor) format selection (formmatselect) font selection (fontselect) font size selection (fontsizeselect) Style selection (styleselect) unordered list (bullist) numbered lists (numlist) reduce indent (outdent) indentation (indent) help (WP_HELP) Open the HTML code Editor (the Code) horizontal line (HR) to clear redundant code ( Cleanup (sub) subscript (SUP) special symbol (CHARMAP) insert more label (wp_more) Insert tab (wp_page) Hide button display switch (WP_ADV) Hide button area start part (Wp_adv_start) Hide button area End (wp_adv_end) spell check (spellchecker)

Related Article

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.