Forums

tinyMCE / the_editor() in a page (5 posts)

  1. d.busby
    Member
    Posted 7 months ago #

    Hi All,

    I can't post directly in wp-advanced so I am posting here.

    What I am trying to do is get the_editor() aka wordpress's tinyMCE embedded into a non admin area, in this case a page.

    This is to allow contributors to create UGC (User generated content) without accessing the admin screen, keeping the process as simple as possible.

    It seems however the documentation surrounding the_editor() function call is lacking, and does not include a complete list of scripts & css files that must be loaded in order for the editor to work outside of an admin area (where people are just assuming that the css/js is already loaded).

    Any help would be greatly appreciated.

    Thanks in advance.

  2. d.busby
    Member
    Posted 7 months ago #

    Example:

    add_filter('wp_head','ugc_content');
    
     function ugc_content(){
    	wp_admin_css('thickbox');
    	wp_enqueue_script('post');
    	wp_enqueue_script('editor');
    	wp_enqueue_script('editor-functions');
    	add_thickbox();
    	wp_enqueue_script('media-upload');
    	wp_enqueue_script('jquery');
    	wp_enqueue_script('jquery-ui-core');
    	wp_enqueue_script('jquery-ui-tabs');
    	wp_enqueue_script('tiny_mce');
     }
    
    ....
    
    <?php if ( current_user_can('edit_posts') ) : ?>
        <div id="postrichdiv" class="postarea">
    	<?php the_editor(''); ?>
        </div>
    <?php endif; ?>

    The above will include the editor, with javascript errors, such as switchEditors not defined, also it will not render correctly so I am assuming another CSS file is required to be included.

  3. d.busby
    Member
    Posted 7 months ago #

    ** bump **

  4. z.b.q
    Member
    Posted 3 months ago #

    Hi d.busby

    I have the similar problem with you. It give me an error as "switchEditors not defined"

    And the css seems not work.
    Have you solved it yet?

  5. lovi9573
    Member
    Posted 1 month ago #

    Glad to see I'm not the only one with this issue. I as well wanted to embed the tinyMCE editor into the pages to create a quick simple way to add or edit posts without going to admin. Similarly, using the_editor() I get the html editor without the proper css applied and a click on visual pops up a "switchEditors not defined". Hopefully someone has a solution for this?

Reply

You must log in to post.

About this Topic