[wp-hackers] WP Ideas: API for adding simple buttons to TinyMCE

Jeremy Clarke jer at simianuprising.com
Fri Mar 19 17:01:23 UTC 2010

Basic idea: Add a wrapper function to WP that can be called in a
theme's functions.php (or a plugin) to add simple buttons to the
Visual Editor. Things like <p class="translation">  or <p
class="update"> that correspond with classes in the theme CSS. There
are a lot of times when a button just needs to wrap a tag around a bit
of text and it seems to me a general function that sets the before and
after text (i.e. <p class="..."> and </p>) would be useful to almost
every site with carefully considered CSS styles for posts.

It's possible to add buttons like this to TinyMCE yourself manually in
a plugin but its really, really complicated. Last time I checked it
involved creating several files and basically becoming skilled at the
TinyMCE API, something most theme/plugin devs would obviously rather
avoid. For this reason I think it would make sense for WP to have a
built-in way of adding simple buttons with only PHP. I am no good at
javascript so I won't be the one to add it but someone out there who
knows how to add buttons already could probably do it relatively

I posted about this on the Ideas Forum about a year ago:

Jane is cleaning out the ideas and will delete this one unless it gets
some more traction so if you think its a good idea please go vote or
leave a comment about it. I suppose if it gets enough votes in the
next little while I'll create a Trac ticket out of it and we can deal
with it in that format instead, otherwise we can delete it from ideas
and let it fade into the annals of features that time forgot.

Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org

More information about the wp-hackers mailing list