$the_editor = apply_filters( ‘the_editor’, ‘<div id=”wp-‘ . $editor_id_attr . ‘-editor-container” class=”wp-editor-container”>’ .
$quicktags_toolbar .
‘<textarea’ . $editor_class . $height . $tabindex . $autocomplete . ‘ cols=”40″ name=”‘ . esc_attr( $set[‘textarea_name’] ) . ‘” ‘ .
‘id=”‘ . $editor_id_attr . ‘”>%s</textarea></div>’ );
I’m trying to add a rich text editor to my own plugin.
So I googled it first of course and I found serveral answers like:
https://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/
https://stackoverflow.com/questions/10377496/add-rich-text-editor-in-wp-plugin
This code displays nothing so I tried finding a another solution:
https://www.ads-software.com/support/topic/adding-rich-text-editing-to-your-plugin?replies=15
This displays a rich text edtior like :
https://oi35.tinypic.com/mwcsug.jpg
This seems to work fine, but as soon I switch to the WYSIWYG tab the text I inserted is deleted, I only see a blanco field and I can’t type anything.
Is someone familiair with this problem?
Is this a bug or what can I do to make it work?
FYI these scripts and styles are included in my plugin:
function highlights_style() {
wp_enqueue_style('thickbox');
}
function highlights_script() {
wp_register_script( 'jquery.js', HIGHLIGHTS_PLUGIN_URL . 'jquery.js', array('jquery','media-upload','thickbox'));
wp_enqueue_script( 'jquery.js' );
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script( 'editor' );
wp_enqueue_media();
add_action( 'admin_head', 'wp_tiny_mce' );
}
And I use this to display the editor:
the_editor( '' , 'content' );
I hope someone can help me!
Thanks!
I need answers for my questions.
1.How to get rid of visual editor in wordpress?
2.How to force the editor to use text mode by default?
I have tried something but nothing works.. please help.
]]>I’m recently developing a premium theme with theme setting page.
In theme setting page, there are many menus and when we need to go to other menu, the content will be loaded by AJAX.
In the content ( theme setting for any sections, for ex : portfolio ), there are word editors to input the values. I use the_editor from wordpress functions.
but unfortunately, it didn’t work. the javascript isn’t working but the media upload tab and VISUAL/HTML tab are working.
i tried to embed with jscript file from wordpress :
- /wp-includes/js/tinymce/wp-tinymce.php?c=1
- /wp-includes/js/tinymce/langs/wp-langs-en.js
and with javascript code
<script type="text/javascript" language="javascript1.2">
var quicktagsL10n = {"wordLookup":"Enter a word to look up:","dictionaryLookup":"Dictionary lookup","lookup":"lookup","closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","fullscreen":"fullscreen","toggleFullscreen":"Toggle fullscreen mode"};var wpLinkL10n = {"title":"Insert\/edit link","update":"Update","save":"Add Link","noTitle":"(no title)","noMatchesFound":"No matches found."};
(function(){
var init, ed, qt, first_init, mce = true;
console.log(tinyMCEPreInit.mceInit);
if ( typeof(tinymce) == 'object' ) {
tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
for ( ed in tinyMCEPreInit.mceInit ) {
if ( first_init ) {
init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] );
} else {
init = first_init = tinyMCEPreInit.mceInit[ed];
}
if ( mce )
try { tinymce.init(init); } catch(e){}
}
}
if ( typeof(QTags) == 'function' ) {
for ( qt in tinyMCEPreInit.qtInit ) {
try { quicktags( tinyMCEPreInit.qtInit[qt] ); } catch(e){}
}
}
})();
var wpActiveEditor;
jQuery('.wp-editor-wrap').mousedown(function(e){
wpActiveEditor = this.id.slice(3, -5);
});
</script>
the editor is working. ok
but… i found a glitch, when i went to other menu, sometimes the editor does not working ( only the tab ). or when i go to HTML tab and back to visual tab, it doesn’t work..
i need all your help for this. if you have ever made like i described, please i need your guidance
tahnk you all
]]>I’m recently developing a premium theme with theme setting page.
In theme setting page, there are many menus and when we need to go to other menu, the content will be loaded by AJAX.
In the content ( theme setting for any sections, for ex : portfolio ), there are word editors to input the values. I use the_editor from wordpress functions.
but unfortunately, it doesn’t work. the javascript isn’t working but the media upload tab and VISUAL/HTML tab are working.
i tried to embed with jscript file from wordpress :
the editor is working. ok
but... i found a glitch, when i went to other menu, sometimes the editor does not working ( only the tab ). or when i go to HTML tab and back to visual tab, it doesn't work..
i need all your help for this. if you have ever made like i described, please i need your guidance
tahnk you all
[closed as duplicate - continue with https://www.ads-software.com/support/topic/calling-the_editor-function-by-ajax-1?replies=1 ]
]]>I have an article directory that uses wordpress.
Before I used (the_editor) to load the visual editor for the users but it’s not working properly.
I loads the editor but the tabs “Visual” and “HTML” do not work then I click on them. Also the “Add media” buttons do not work
here is my code:
<script src="<?php echo get_bloginfo('wpurl'); ?>/wp-admin/load-scripts.php?c=1&load=jquery,utils,editor,quicktags"></script>
<?php if ($options['show_editor'] == '1') { ?>
<script>window.onload = function() { document.getElementById('quicktags').style.display = '<?php if ($options["default_editor"] == "html") echo "block"; else echo "none"; ?>'; }</script>
<?php
wp_print_scripts('quicktags');
require_once(ABSPATH . '/wp-admin/includes/post.php');
function richedit() { return true; }
add_filter('user_can_richedit', 'richedit');
wp_tiny_mce( false, array( 'height' => '370' ) );
if ($options['default_editor'] == 'html') {
add_filter( 'wp_default_editor', create_function('', 'return "html";') );
} else {
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
}
the_editor($_POST['post'], 'post' , '', false);
} else {
echo '<style type="text/css">#quicktags {display:none}</style>';
the_editor($_POST['post'], 'post' , '', false);
}
?>
]]>I’m developing or making customize Option Panel, which is based on these tutorial I found – Option Panel.
Also I successfully implemented/embed the TinyMCE on the textarea.
(I’m using the the_editor() function)
Everything run perfectly but I have noticed the output has something wrong. When I put some styles on the fonts/image in the editor. The output on the page is plain, no styles output.
I notice this in the page source view. The inline css tags are messed-up…Some has backslash and some tags are misplace.
Ex-1: Styling the font
<span underline;\"="" text-decoration:="" #888888;="" style="\"color:">11212121</span>
Ex-2: Center the image
<p center;="" style="text-align:"><img height="183" alt="width=300" src="https://localhost/wp/wp-content/uploads/2012/02/2011-Land-Rover-Range-Rover-300x183.jpg" title="2011-Land-Rover-Range-Rover" aligncenter="" wp-image-46="" class="size-medium"></p>
My customize page source code:
<div class="content-cont">
<div id="content">
<?php
$getoptB = get_option('pg_foot_label_b');
$getoptB = do_shortcode($getoptB);
$getoptB = wpautop($getoptB);
echo $getoptB;
?>
</div>
</div>
—
Is there something I miss or I have wrong functions retrieving values. I’m not really good in WP customize templates. Help please thanks.
<span id="more-38"></span>
. It is completely lost in visual mode and disappears from the html view if you flip between the two views.
Here’s what I think is the essential code in the plugin that calls the content and places it into the editor.
<?php global $more; // Declare global $more (before the loop). ?>
<?php $more = 1; // Set (inside the loop) to display all content, including text below more. ?>
<?php
$content = get_the_content();
wp_enqueue_script(array('jquery', 'editor', 'thickbox', 'media-upload'));
wp_enqueue_style('thickbox');
?>
<?php the_editor($content);?>
]]>i want to assign a class to TextArea Generated BY TinyMCE so Can Any Buddy Have And Important Link of Have idea then Please share it with me
Actually my Gloal is that i want to Use TinyMCE Editor [ Default one ] for my plugin.
Please Share Any of Imp link You Find Fot that Thanking You
By Anand Thakkar
]]>Here is the code in one of my attempts:
add_filter('admin_head','myplugin_tinymce');
function myplugin_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');
}
?>
<div id="poststuff">
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"><?php the_editor("<strong>hello world strong!</strong>"); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
</div>
</div>
I’ve entered the code above in the same file. Not sure where I was supposed to put it.
Also if this somehow gets to work could qtranslate plugin recognise the textarea and add its language tabs?