I’ve searched & searched and cannot find a clear answer about how to do the following…
I want to add some sort of option (probably a drop-down menu) for changing text in a post to have a headline tag of some kind (h1, h2, etc.). But, most of the forum posts regarding this simply have “why not do it by hand?” as the reply.
The set-up of WP is for a friend that doesn’t know anything about HTML and needs the benefit of the WYSIWYG editor. Is there any way to add buttons to the native visual rich editor?
I’ve found this document http://tinymce.moxiecode.com/tinymce/docs/option_valid_elements.html
but am not sure how one might use that within WP.
Any other options or ideas?
Thanks for any & all help!
OK, I may have found the solution (I’m not 100% on this, so verification from someone else would be greatly appreciated!) and am posting it here so that others searching for the same problem might find my solution helpful.
- Visit http://tinymce.moxiecode.com/tinymce/docs/reference_buttons.html to find the name of the button you are interested in added. In my case, I wanted to add a method for applying a format to a paragraph (h1, h2, etc.) this is called “formatselect.”
- Open the file “tiny_mce_gzip.php” in the “tinymce” folder within the “js” folder that’s within the “wp-includes” folder. So, it’s wp-includes>js>tinymce>tiny_mce_gzip.php
- Find the code that reads:
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));
- Add the button name that you wish to have show up in the button array. In my case, I wanted “formatselect” so I modified the code to display as:
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'formatselect', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));(adding both “formatselect” and a separator)
Viper007Bond: THANK YOU.
Thank you, thank you, thank you.
In all my searching, I never saw that “mini-plugin.” It is absolutely perfect; and, from what I’ve seen in these support forums, a plug-in for which many more people are looking. Hopefully, this post will help them find it.
(also: your video Quicktag plug-in looks quite good. I’ll download that for future reference!)
Thanks for the link. Got really fed up searching for how exactly to add a button.
Any clue on where to add it in the codex?
Why is this not in the core? H1 tags are a basic building block of the web.
Show the rest of the editor buttons: http://wordpress.org/extend/plugins/visualize-advanced-features/
- The topic ‘Can I Add a Button to Visual Rich Editor?’ is closed to new replies.