WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. d.busby
    Member
    Posted 4 years 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 4 years 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 4 years ago #

    ** bump **

  4. z.b.q
    Member
    Posted 4 years 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 4 years 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?

  6. tmuka
    Member
    Posted 4 years ago #

  7. lukekfreeman
    Member
    Posted 4 years ago #

    This doesn't work for calling it from the wordpress front end. I just get call to undefined function when I use this code

    <?php
       wp_tiny_mce( false , // true makes the editor "teeny"
           array(
               "editor_selector" => "reply_content"
           )
       );
    	?>

    from within a wordpress page (trying to get rich text replies).

Topic Closed

This topic has been closed to new replies.

About this Topic