The MU forums have moved to WordPress.org

TinyMCE as visual/html editor in custom plug-in (1 post)

  1. mdgross
    Member
    Posted 14 years ago #

    I've learned that WordPress comes bundled with TinyMCE by default.

    I visited the TinyMCE homepage and copied the simple example source code:

    <script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
    tinyMCE.init({
    	mode : "textareas",
    	theme : "simple"
    });
    </script>
    
    <form method="post" action="somepage">
    	<textarea name="content" style="width:100%">
    	</textarea>
    </form>

    I remove the following:

    <script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>

    I added the following:

    add_action('admin_head','my_tiny_mce');
    function my_tiny_mce() {
        wp_enqueue_script('tiny_mce');
    }

    However the result is just an empty textarea.

    I've tried using the code in this similar post but didn't have any success.

    I also found this thread which uses the_editor(). I was able to get it working except for the ever so important visual/html view.

    Can you please help me include a visual/html editor in my custom plug-in? Thanks!

About this Topic

  • Started 14 years ago by mdgross