How I can use TinyMCE for my own plugin (8 posts)

  1. Bagira
    Posted 7 years ago #

    Hi, I must write a plugin with administration panel, somethig like "Write Post". I need for WYSIWYG. I know, that WordPress use TinyMCE. But i can't include it to my Plugin. How can I do it? I'm newbie in WordPress programming. Help me please. Thanks.

  2. noamnativ
    Posted 7 years ago #

    Hi Bagira
    I guess you can add a new advanced text area by using the 'the_editor' function:

    the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2)

    so,for example, if you want to add a new field with the name 'thoughts_list'
    You can do it this way:


    Hope this helps.

  3. Bagira
    Posted 6 years ago #

    Thanks, but I have problems with your code :

    the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2)

    the buttons of "Add an Image", "Add video" and "Visual" doesn't works, no error and nothing happens.

    The button "HTML" gives me the JavaScript error "switchEditors is not defined".

    The other problem is that when I write, the text appears in white colour, I only can see what I type if I mark the text.

    What should I do?

  4. inlanger
    Posted 6 years ago #

    I have this problem too... How I can explain it?

  5. Laurent J.V. Dubois
    Posted 6 years ago #

    You could take a look to this very interesting article :

  6. Adcaelo
    Posted 6 years ago #

    according to http://blog.zen-dreams.com/en/2009/06/30/integrate-tinymce-into-your-wordpress-plugins/
    you need to enqueue script in wordpress header (for me it's admin header)

    so :

    function ShowTinyMCE() {
    	// conditions here
    	wp_enqueue_script( 'common' );
    	wp_enqueue_script( 'jquery-color' );
    	if (function_exists('add_thickbox')) add_thickbox();
    	if (function_exists('wp_tiny_mce')) wp_tiny_mce();



    where you want your tinyMCE text area

    Not perfectly working with WP 3.0 (beta) i'm working on it, but you can use it as a text area and media upload work (upload file / add code into text)

  7. ArkaneArkade
    Posted 6 years ago #

    I was actually looking to do this myself last week, and got a different answer, which seems easier to me.
    The page I got the info from in the end was http://www.keighl.com/2010/01/tinymce-in-wordpress-plugins/

    Basically, add wp_tiny_mce() into your page with the textarea you want. The override info is all in that link.

    The only thing I found was that many people have had issues using multiple textareas. I have it working quite successfully, as long as you make sure that they have the same class and id, but different names.

  8. Scott Kingsley Clark
    Posted 6 years ago #

    I've had nothing but issues trying to use the built-in TinyMCE editor with the_editor or wp_tiny_mce when needing multiple editors on one page. The best results would probably to put together the JS separately and link those files to the WP included ones -- but circumvent the use of the default WP functions for TinyMCE. Only in this way do I believe I can make TinyMCE finally work multiple times the way it's expected.

    The default code like the_editor and wp_tiny_mce just aren't built to be used multiple times on a page and have their many limits.

Topic Closed

This topic has been closed to new replies.

About this Topic