4127 posts
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
Ivor
moderator
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> </td>
<td> </td>
</tr></tbody>
</table>
</div></div></div></div>
<?php break;
</pr?>
4127 posts
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
Ivor
moderator
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');
