While developping ZdMultilang’s new version, I came accross a compatibilty problem with Wordpress 2.7.
In fact, to include the tinyMCE editor you won’t use the same functions between 2.6.3 and 2.7 releases. More interesting is WP2.7 will need one more function to be able to display the editor.
Most of the time you will want to include this editor when working with posts, or when you want to enable your plugin users to enter information with the Wysiwyg editor (newsletter, advanced widgets, etc…)
Wordpress 2.5.x and 2.6.x
Here is how to include the editor in one of your plugin’s admin panel.
- Include this code in the admin_head hook
add_filter('admin_head','zd_multilang_tinymce'); function zd_multilang_tinymce() { wp_admin_css('thickbox'); wp_print_scripts('post'); wp_print_scripts('editor'); add_thickbox(); wp_print_scripts('media-upload'); wp_print_scripts('jquery'); wp_print_scripts('jquery-ui-core'); wp_print_scripts('jquery-ui-tabs'); } - Call the editor anywhere you need it to be displayed
the_editor($content_to_load);
Wordpress 2.7
Here is how to include the editor in one of your plugin’s admin panel.
- Include this code in the admin_head hook
add_filter('admin_head','zd_multilang_tinymce'); function zd_multilang_tinymce() { wp_admin_css('thickbox'); wp_print_scripts('jquery-ui-core'); wp_print_scripts('jquery-ui-tabs'); wp_print_scripts('post'); wp_print_scripts('editor'); add_thickbox(); wp_print_scripts('media-upload'); if (function_exists('wp_tiny_mce')) wp_tiny_mce(); // use the if condition because this function doesn't exist in version prior to 2.7 } - Call the editor anywhere you need it to be displayed
the_editor($content_to_load);
Differences between versions.
As you can see, there is only one difference in the code between both version, but this is a major one as if you don’t call the wp_tiny_mce function, the editor will not work at all.
There are some other differences but mostly in the css classes as the design has been totally revamped. Therefore if you want to mimic the interface on both version you will need to add some classes and divs as you will see when I’ll publish ZdMultilang v1.1.2 ;)
By the way, I’m proud to announce that version 1.1.2 of ZdMultilang will be fully compatible with Wordpress 2.7 and the interface will look much better in 2.6.3 and 2.7 than right now.








2 Comments
Hi Anthony,
I’m excited to hear this. If you like you can Email the new Beta version to me and I’ll start some testing for you.
I forgot to ask, where in Canada are you moving? (my guess would be Montreal, Quebec. I lived for over 30 years in Canada myself and have been all over this beautiful country.
Cheers, Markus
Markus, I’ll send you a Beta version during the week, I expect to release next version next week :)
No, I’m not moving to Montréal, I’m moving to Vancouver :) But your guess was legitimate as I’m french ;)
One Trackback
[...] How-To include tinyMCE in your WP plugin | Zen-Dreams This post about adding TinyMCE to your WordPress plugin includes instructions for WordPress 2.7. (tags: wordpress programming plugins) SHARETHIS.addEntry({ title: “links for 2008-12-02″, url: “http://michaelwender.com/2008/12/02/links-for-2008-12-02/” }); This entry was written by Michael Wender, posted on December 2, 2008 at 2:00 pm, filed under Links. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. « Oldest Ever Lolcat Found - I Can Has Cheezburger? [...]