I am trying to figure out how to modify the HTML editor in wordpress; on the image below you can see a screenshot of the editor and the buttons on the top. Is it possible to add new buttons? I would like to add a button that will insert “” tags and some custom short-code tags as well. I know it’s not impossible, but does anyone know how to do it?
Leave a Reply
You must be logged in to post a comment.
Download and install HTML Editor Reloaded Plugin and go to setting pages and you can add your own new buttons.
http://wordpress.org/extend/plugins/html-editor-reloaded/
If it’s getting too hard and complicated, you can simply add new buttons by using jQuery. Simply clone an existing or create a new button, and append it to the editor’s toolbar. You can wrap the javascript with a php function, and run it in the admin footer or something.
Or you can use the edButton function. Here is a dirty and fast written example for adding p and pre buttons.
EDIT: In WordPress 3.3 (and above), the quicktag addition is changed. However, the edButton lazy solution is somehow working, some plugins might cancel it out.
The new and the right way of adding new buttons to html editor is like this :
I don’t know if the QTags is added to the WordPress Codex yet, so I added the required parameters in the comment section of the code.
See the following in
wp-includes/js/quicktags.dev.js
This might be helpful to some one as well…
http://scribu.net/wordpress/right-way-to-add-custom-quicktags.html
Here is my example of how to add buttons & & to editor text wp
add this code to functions.php and save file after check your editor text
i hope help u ^^
You need to use the tinymce api to add buttons on the editor
http://codex.wordpress.org/TinyMCE_Custom_Buttons
EDIT
Oh, wait: you’re using the HTML editor. The below filter is for adding buttons to the Visual editor.
Almost every reference I can find instructs to edit
quicktags.js
(and is in fact what I used to do), but I do not recommend editing core files. I did find this (completely untested) Plugin that purports to allow for modification/addition of HTML editor quicktag buttons.ORIGINAL ANSWER
You can add buttons to Row 1, Row 2, or Row 3.
Here is an example of how to add buttons to Row 3:
Obviously, you would use
'mce_buttons_1'
to add buttons to Row 1, and'mce_buttons_2'
to add buttons to Row 2.If you want to add your own, arbitrary button, you need to pass the button markup to the array, rather than just the HTML tag name.