is there a way to add tinymce into my own wordpress plugin? i've got a textarea in my backend script and want to make this area into a tinymce wysiwyg editable field.

is there a way to do that?

wysiwyg

edit

<?php
    wp_tiny_mce(false,array("editor_selector" => "test"));
?>
<textarea class="test" id="test" name="test"></textarea>

does not work for me

js error is like mceerror

also

<textarea class="theEditor" id="videogalerie-add_description" name="videogalerie-add_description"></textarea> did not work

Accepted Answer

The following example works for me. Just make sure to use the id of the textarea you want to select in the $a["elements"] variable.

Assuming you have a textarea with the id of 'intro':

// attach the tiny mce editor to this textarea
if (function_exists('wp_tiny_mce')) {

  add_filter('teeny_mce_before_init', create_function('$a', '
    $a["theme"] = "advanced";
    $a["skin"] = "wp_theme";
    $a["height"] = "200";
    $a["width"] = "800";
    $a["onpageload"] = "";
    $a["mode"] = "exact";
    $a["elements"] = "intro";
    $a["editor_selector"] = "mceEditor";
    $a["plugins"] = "safari,inlinepopups,spellchecker";

    $a["forced_root_block"] = false;
    $a["force_br_newlines"] = true;
    $a["force_p_newlines"] = false;
    $a["convert_newlines_to_brs"] = true;

    return $a;'));

 wp_tiny_mce(true);
}

?>

Written by Camden Daily
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki