WordPress 2.1 – More on those Editor Options

February 11, 2007 by Chris · 28 Comments 

Update: Plugin Released

A week and a half ago I wrote an article about the "hidden" advanced features in the WordPress 2.1 wysiwyg editor. I mentioned the support forum thread where I learned about this and there has been some interesting discussions there recently.

I wondered if I could at least get the button to toggle the toolbar to show up all the time -- without modifying core files. I don't want the advanced bar there all the time, but I thought it would be cool to show the toggle to make it easier for more browsers/platforms to get at it.

A quick peek at the Plugin API/Hooks documentation shows that there are some mce hooks (TinyMCE is what is used for the wysiwyg editor).

[updated!] Ignore this tripe. Check out Mark Steel's comment below for a proper function

I have the beginnings of something interesting now, but it isn't quite perfect...

PHP:
  1. /*
  2. Plugin Name: Visualize Advanced Features
  3. Plugin URI: http://www.solo-technology.com/blog/2007/02/11/wordpress-21-more-on-those-editor-options/
  4. Description: Show the advanced options button all the time
  5. Version: .01
  6. Author: Chris Kasten, aka HandySolo
  7. Author URI: http://www.solo-technology.com/blog/
  8. License:  Creative Commons Attribution-ShareAlike 2.5
  9. http://creativecommons.org/licenses/by-sa/2.5/
  10. */
  11.  
  12. add_filter('mce_buttons', 'st_addAdvanced', 0);
  13.  
  14. function st_addAdvanced($buttons) {
  15. unset($buttons[22]);
  16. array_push($buttons, 'wp_adv');
  17. return $buttons;
  18. }
  19. ?>

Toss that in a .php file, lob it into your plugins directory and activate it.
Visit the Write Posts screen and you'll see a new button at the right end. Clicking it shows the advanced toolbar! However, my button then gets moved to a 3rd row. Obviously, I have some layout issues.

If you can improve it, run wild and drop a link here to your improved version.

Possibly Related posts:

  1. WordPress 2.1 – More Editor Options
  2. First Release: Visualize Advanced Features
  3. Couple WP Plugins
  4. Humility and building a WordPress Plugin
  5. WordPress Plugin Directory

Comments

28 Responses to “WordPress 2.1 – More on those Editor Options”

  1. [...] Been pondering how to toggle with a simple [...]

  2. annette says:

    you’re my hero. I was going crazy wondering “where are the rest of the buttons?!” I couldn’t believe I saw no one else screaming about this sooner…
    thanks

  3. Chris says:

    Annette – Hero! :-) Thank you kindly.

  4. Tom Johnson says:

    I tried putting that into a php file and uploading it to my plugins folder, but I couldn’t get it to work. Am I doing something wrong?

  5. Chris says:

    Hi Tom, I added proper opening and closing php tags to my little snippet above. See if that makes a difference?

  6. Artemis says:

    w00t! Thank you for the plugin… it works great!!

  7. xinfo says:

    Hi solo

    with out plugin my button’s are not visable i thought this plugin will help me but still same problem

    Nice plugin for those who need extra option

    I tried in local system work well

  8. Mark Steel says:

    Change the function to something a little less esoteric — simplicity rules the day:

    function st_addAdvanced($buttons) {
    $x=$buttons[21];
    $buttons[21]=’wp_adv’;
    $buttons[22]=$x;
    return $buttons;
    }

  9. Chris says:

    Lol! My weak php-fu is exposed yet again.

    Mark, I think you’re on to something there but the example you gave causes me to lose the wp-adv button altogether.

    Or maybe I need to see if it is still in the array with 2.1.1 …?

  10. Chris says:

    … or I’m a doofus and let Notepad mangle the single-quotes.

    Fresh install, gotta find time to get Notepad++ back on here!

    Works great!

  11. [...] — and Chris is a brilliant guy, mind you, and again, I’m not bashing him — was the beginnings of a WordPress plugin (blog software, for the initiated) to show extra formatting but…. function st_addAdvanced($buttons) {     unset($buttons[22]);     array_push($buttons, [...]

  12. [...] hidden editor buttons in the WordPress 2.1x WYSIWYG. I’d just begun to figure out plugins and started to sketch one out that would always show a toggle to see the “hidden” buttons. It didn’t work real [...]

  13. Mark Steel says:

    Awww, man, I’m sorry. I totally didn’t mean it like that. Like I said, your thing wasn’t anything wrong … just … heavy-handed. *grin*

    Glad it’s working. But, remember, yours worked, too. ;-)

  14. Mark Steel says:

    Hey, I have a better idea — you call it 0.2 and drop my name and link in the credit. ;-)

  15. [...] WordPress plugin that does that. Its probably one of the simples plugins around except for maybe this. Its only 23 lines, with comments. PLAIN TEXT [...]

  16. Joe says:

    Got a question for you, how do you get iG:Syntax Hiliter to not put blank lines in between the line number?

  17. Chris says:

    Mark – Stay tuned…

    Joe – Just lucky I guess. ;-) I don’t recall tweaking the CSS at all. Perhaps your theme has some stylesheet stuff impacting it?

  18. Chris says:

    Joe – Yikes! I went to have a look and your blog is empty!

  19. Joe says:

    Thanks… Its been doing that all day. Can’t figure out why though. All my other blogs are working fine. Should be back up in a minute. :-)

  20. June says:

    I tried it on WP2.1.2, it shows nothing more on the Editor bar…. :(

  21. Chris says:

    I assume you’re using the plugin linked at the top of this page? I promise, it works with 2.1.2.

    After activating the plugin, you might need to refresh or clear your browser cache. With many browsers, ctrl-F5 is the shortcut to do that. Try it while on the Write Posts page and see what happens.

  22. Mike In WNY says:

    I’m also running WP 2.1.2 and having no luck with the extra buttons showing up. I installed the plugin on another blog I maintain that uses WP 2.1 and it is fine.

  23. Mike In WNY says:

    Ignore my last comment. I redownloaded the file and reinstalled it, now it works. Go figure.

  24. Joe says:

    Hi,
    I fixed the problem, it was K2. I added one line to the CSS and everything is working fine. :-) Thanks…

  25. kaiser says:

    Hi Mr. Solo again,
    i worked tinymce into one of my sites some days ago. perfect! here´s my contribution-link to this post:

    maxpower[DOT]ca/
    how-to-add-buttons-to-
    the-wordpress-editor-for-
    your-plugin-theme/2006/10/28/

    enjoy!

  26. Chris says:

    Hey Kaiser, thanks for sharing the link.

    WordPress 2.3 adds a button that means you won’t need to remember this shortcut anymore :-)

Leave a Reply

  • About

    Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More...
  • Referrals and Ads



    Mozy Logo for Referral

    Dropbox Logo for Referral

    Dreamhost Promotion
    Get $50 off at Dreamhost — Just mention SOLOTECH50 when signing up!

  • Topics

  • Flair and Sparklies