4268 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says

Hey guys I’m having a hard time trying to insert the editor in my panel I’m doing this: – The thing is that the editor appears but is broken.

function admin_tinymce()
{
  wp_enqueue_script('common');
  wp_enqueue_script('jquery-color');
  wp_admin_css('thickbox');
  wp_print_scripts('post');
  wp_print_scripts('media-upload');
  wp_print_scripts('jquery');
  wp_print_scripts('jquery-ui-core');
  wp_print_scripts('jquery-ui-tabs');
  wp_print_scripts('tiny_mce');
  wp_print_scripts('editor');
  wp_print_scripts('editor-functions');
  add_thickbox();
  wp_tiny_mce();
  wp_admin_css();
  wp_enqueue_script('utils');
  do_action("admin_print_styles-post-php");
  do_action('admin_print_styles');
  remove_all_filters('mce_external_plugins');
}

function tinymce_scripts_hook() {
    global $page_handle;

    $svr_uri = $_SERVER['REQUEST_URI'];
    if ( strstr($svr_uri, $page_handle) ) { 
        return true; 
    }            
}

function admin_scripts_hook() {
    global $page_handle;

    $svr_uri = $_SERVER['REQUEST_URI'];
    if ( strstr($svr_uri, 'post.php') || strstr($svr_uri, 'post-new.php') || strstr($svr_uri, 'page.php') || strstr($svr_uri, 'page-new.php') || strstr($svr_uri, $page_handle) ) { 
        return true; 
    }            
}

add_action('admin_enqueue_scripts', 'admin_enqueue_scripts');

if(admin_scripts_hook()) {
add_action('admin_print_scripts', 'admin_print_scripts');
}
if(tinymce_scripts_hook()) {
add_filter('admin_head','admin_tinymce');
}
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

        case 'content_editor':
        ?>
        <h2 style="margin:20px 0 35px 0;"><?php echo $value['name']; ?></h2>
        <div id="poststuff"><div id="post-body"><div id="post-body-content"><div class="postarea" id="postdivrich">

        <?php $the_editor_content = stripslashes($get_options['content']);
        the_editor($the_editor_content); 
        ?>

        <table cellspacing="0" id="post-status-info">
            <tbody><tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            </tr></tbody>
        </table>
        </div></div></div></div>

        <?php break;
</pr?>
4268 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says

It worked finally with this:

function admin_tinymce() {
    wp_enqueue_script('word-count');
    wp_enqueue_script('post');
    wp_enqueue_script('media-upload');
    wp_enqueue_script('common');
    wp_enqueue_script('jquery-color');
    wp_admin_css('thickbox');
    wp_print_scripts('post');
    wp_print_scripts('jquery');
    wp_print_scripts('jquery-ui-core');
    wp_print_scripts('jquery-ui-tabs');
    wp_print_scripts('tiny_mce');
    wp_print_scripts('editor');
    wp_print_scripts('editor-functions');
    add_thickbox();
    wp_tiny_mce();
    wp_admin_css();
    wp_enqueue_script('utils');
    do_action("admin_print_styles-post-php");
    do_action('admin_print_styles');
    remove_all_filters('mce_external_plugins');

}

function editor_admin_head() {
  wp_tiny_mce();
}

add_action('admin_init', 'admin_tinymce');
add_action('admin_head', 'editor_admin_head');
1012 posts
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 more
wizylabs says

glad it worked :D

by
by
by
by
by
by