Wordpress admin: how to add text editor into plugin textarea?

admin

Administrator
Staff member
I recently had to update an old (3.0.1) Wordpress site while keeping all admin functions, plugins, etc. the same as before. The only thing that messed up is the wysiwyg field in an old 'More Fields' plugin, it used to work as a tinyMCE text editor and now it's just a textarea with html markup.

From what I can tell this is how it gets called from more-fields-object.php:

Code:
    $wysiwyg = new mf_field_type;
    $wysiwyg->title = __('WYSIWYG', 'more-fields');
    $wysiwyg->html_before = '

    <script type="text/javascript">
        /* <![CDATA[ */
//  jQuery(document).ready( function () { 
//      tinyMCE2 = tinyMCE;
        tinyMCE.init({
            mode:"textareas",
            width:"100%",
            theme:"advanced",
            skin:"wp_theme",
            theme_advanced_buttons1:"bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,spellchecker,fullscreen,wp_adv",
            theme_advanced_buttons2:"", //formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,wp_help",
            theme_advanced_buttons3:"",
            theme_advanced_buttons4:"",language:"en",spellchecker_languages:"+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv",
            theme_advanced_toolbar_location:"top",
            theme_advanced_toolbar_align:"left",
            theme_advanced_statusbar_location:"bottom",
            theme_advanced_resizing:"0",
            theme_advanced_resize_horizontal:"",
            plugins:"safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage",
            editor_selector:"%key%"
        });
//  });     

        jQuery(document).ready( function () { 
            jQuery("#%key%").addClass("mceEditor");
            if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
            tinyMCE.execCommand("mceAddControl", false, "%key%");
            }
        }); 

        /* ]]> */
        </script>
        <div style="width: 100%">
    <textarea class="%class% %key%" name="%key%" id="%key%">' . "\n";

    $wysiwyg->html_item = "%value%";
    $wysiwyg->html_after = "</textarea></div>\n";
    $this->field_types[] = $wysiwyg;

<a href="https://www.dropbox.com/s/9scickp3wqe9yeb/more-fields-object.php?dl=0" rel="nofollow">This is the whole file</a>

I've tried crowbarring in wp_editor in various ways but my php skills are very basic, so can anyone please tell me how I can make that textarea into a text editor box? Whether it's with php or jQuery or whatever, it really needs to only have a bunch of formatting buttons so it's easier for the editor to post content.

Thanks!