Wordpress - How do I include a TinyMCE editor in the frontend?
Well, Thanks to wp 3.3 now we have wp_editor()
function to do that :)
editor_selector
is for targeting classes, not ids.
Also, when using editor_selector
, it is required to set mode: "specific_textareas"
in order for it to work.
See http://tinymce.moxiecode.com/wiki.php/Configuration:editor_selector
So your JavaScript and HTML should look like this:
jQuery(document).ready(function(){
tinyMCE.init({
mode : "specific_textareas",
theme : "simple",
/*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/
editor_selector :"tinymce-enabled"
});
});
<textarea rows="8" cols="40" name="description" id="editor" class="tinymce-enabled required"><?php echo $description;?></textarea>