WordPress Tinymce text fields (raw HTML and JS code)

Once tinymce is loaded onto the admin page you want to work with, just use the code below to replace a textarea with the tinymce editor.

Check out this blog ( http://blog.zen-dreams.com/en/2009/06/30/integrate-tinymce-into-your-wordpress-plugins/ ) for info about getting the neccessary code in the head of your page if you are not adding text boxes to the page or post sections of the admin interface.

<script type="text/javascript">
/* <![CDATA[ */

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

/* ]]> */
</script>
<textarea name="my_plugin_textarea" id="my_plugin_textarea"></textarea>

Related Posts:

  • No Related Posts
This entry was posted in Web Development and tagged , . Bookmark the permalink.

One Response to WordPress Tinymce text fields (raw HTML and JS code)

Leave a Reply

Your email address will not be published. Required fields are marked *