3

I've been looking for a way to add a button to wrap text in for the WYSIWYG editor in Wordpress 3.3.1.

I tried this:

function enable_more_buttons($buttons) {
 $buttons[] = 'code';
 return $buttons;
}
add_filter("mce_buttons_3", "enable_more_buttons");

But that did not work as expected. It did display a button, but it brings up a popup window to edit the HTML.

In addition to it would be nice to have and .

4
  • With TinyMCE, "code" refers to the markup of the textbox itself. It's supposed to launch a popup window to edit the HTML. You need a way to add a custom button, because there isn't a baked-in "preformatted" feature. I recommend asking on Stack Overflow instead, because this is TinyMCE-related, not WordPress-related, and will be closed as off-topic soon enough.
    – EAMann
    Jan 31, 2012 at 22:51
  • I finally found a plugin that did just what I wanted - a button for <code> in the WYSIWYG editor: WYSIWYG Inline Code Command
    – thomthom
    Jan 31, 2012 at 23:27
  • Please post your answer as a new Answer below and accept it so others can learn what you did. Providing a link out to the plugin would also be useful.
    – EAMann
    Feb 1, 2012 at 0:23
  • Ah - sorry. Posted in the wrong textbox.
    – thomthom
    Feb 1, 2012 at 11:47

1 Answer 1

7

I finally found a plugin that did just what I wanted - a button for in the WYSIWYG editor: WYSIWYG Inline Code Command

3
  • Mark the question as answered please.
    – fuxia
    Feb 6, 2012 at 11:26
  • Done! Thanks for reminding me. It wouldn't let me mark it when I first posted. Had to wait 24 hours - forgot.
    – thomthom
    Feb 6, 2012 at 13:25
  • TinyMCE Code Button is another plugin that does the same thing. (Neither plugin seems to be actively maintained, so there's a risk that one or the other might disappear from the plugin repository at some point.)
    – s3cur3
    Dec 19, 2018 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.