WordPress 2.1 - More on those Editor Options

calendar Posted on February 11, 2007   comments 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.

tags Tags: , , , , , ,

Related Posts Possibly Related Posts

Comments

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

  1. » pingback » WordPress 2.1 - More Editor Options » Solo Technology on February 11th, 2007 8:13 am

  2. annette on February 12th, 2007 3:05 pm

    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 on February 12th, 2007 6:51 pm

    Annette - Hero! :-) Thank you kindly.

  4. » pingback » Ampliar el editor WYSIWYG de WordPress 2.1 » La mate por un yogur on February 14th, 2007 4:34 am

  5. Tom Johnson on February 16th, 2007 7:06 pm

    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?

  6. Chris on February 16th, 2007 7:35 pm

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

  7. Artemis on February 21st, 2007 1:33 pm

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

  8. xinfo on February 22nd, 2007 11:19 pm

    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

  9. Mark Steel on February 27th, 2007 6:27 pm

    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;
    }

  10. Chris on February 27th, 2007 7:06 pm

    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 …?

  11. Chris on February 27th, 2007 7:08 pm

    … 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!

  12. » pingback » blogitude.com » Blog Archive » Simplicity Rules the Day on February 27th, 2007 7:18 pm

  13. » pingback » Couple WP Plugins » Solo Technology on February 27th, 2007 8:23 pm

  14. Mark Steel on February 27th, 2007 10:07 pm

    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. ;-)

  15. Mark Steel on February 28th, 2007 11:04 am

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

  16. » pingback » Simple Plugin: about:config at Mostlynothing.info on February 28th, 2007 3:10 pm

  17. Joe on February 28th, 2007 3:24 pm

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

  18. Chris on February 28th, 2007 3:42 pm

    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?

  19. » pingback » First Release: Visualize Advanced Features » Solo Technology on February 28th, 2007 4:55 pm

  20. Chris on February 28th, 2007 10:13 pm

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

  21. Joe on February 28th, 2007 10:20 pm

    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. :-)

  22. June on March 5th, 2007 10:44 am

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

  23. Chris on March 5th, 2007 10:53 am

    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.

  24. Mike In WNY on March 9th, 2007 1:37 am

    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.

  25. Mike In WNY on March 9th, 2007 1:44 am

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

  26. Joe on April 1st, 2007 10:49 am

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

  27. kaiser on September 23rd, 2007 5:12 am

    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!

  28. Chris on September 24th, 2007 8:35 pm

    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




Have you read the Comments section on the Disclaimer page?

About

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

Recent Posts

Recent Comments: