Tag Info

Hot answers tagged

8

You pretty much had it, according to the description. Here's what you might be looking for for instances 2 and 3 (for instance 1 you can leave the settings empty to get the default set of buttons): Instance 2: wp_editor( $distribution, 'distribution', array( 'media_buttons' => false, 'textarea_rows' => 8, 'tabindex' ...


6

Ok apparently WordPress keeps track of what kind of editor (visual or html) is active as a class which is added to the content wrapper so here is a solution that will get you the latest content in the editor function get_tinymce_content(){ if (jQuery("#wp-content-wrap").hasClass("tmce-active")){ return tinyMCE.activeEditor.getContent(); ...


5

only overwrite the send_to_editor function when your link or button is click but store the old function to restore it so try this on a click event: //store old send to editor function window.restore_send_to_editor = window.send_to_editor; //overwrite send to editor function window.send_to_editor = function(html) { var imgurl = ...


5

esc_html() and esc_textarea() are, appropriate to their names, escaping functions and really meant for display rather than sanitizing or validating. I would use wp_kses() or wp_kses_post() (which is just wp_kses() with the global $allowedposttags) to sanitize input from a wp_editor() field before saving.


5

There is at least 1 issue with using wp_editor in a meta box, as discussed in ticket #19173(Good read on the subject of wp_editor and meta boxes). TinyMCE gets all messed up if you move the meta box that contains it (specifically, if TinyMCE's location in the DOM is changed). You can, however, use the Quicktags version (non tinyMCE). Another alternative is ...


4

In your edited_terms function you need to save the value and in your add_tag_form_fields you need replace your test with the saved data. something like: class Test{ function __construct() { //do_action('add_tag_form_fields', $taxonomy); add_action('add_tag_form_fields', array($this, 'add_tag_form_fields')); ...


4

you can set the params via array on the wp_editor() function; an exmaple $settings = array( 'tinymce' => array( 'setup' => 'function (ed) { tinymce.documentBaseURL = "' . get_admin_url() . '"; }', ), 'quicktags' => TRUE, 'editor_class' => 'frontend-article-editor', 'textarea_rows' => ...


4

You need to add a name attribute to your editors. The name attribute needs to be set to the value of of your option, so like this: function us_partners_cb() { $us_partners_desc = get_option( 'us_partners_desc' ); echo wp_editor( $us_partners_desc, 'uspartnersdesc', array('textarea_name' => 'us_partners_desc') ); }


4

It's a bug http://core.trac.wordpress.org/ticket/21197 Using the shortcut pulls up the TinyMCE fullscreen editor rather than the custom wordpress fullscreen editor. Update 13. July 2012: Fixed in Changeset 21266.


4

While @s_ha_dum’s solution works fine on a custom plugin page, it will fail if you use TinyMCE on a post editor page after the first editor instance has been called, because it would either affect all editors or at least the editors later on the same page. TinyMCE parses custom styles into its settings during the first run only. How to remove the custom ...


3

The TinyMCE has an Filter for all allowed tags. You can change the tags, there are set in standard for your options and the editor fitler the tags. Its not necassary, that you filter after save. Example for enhanced tags: function fb_change_mce_options( $initArray ) { // Comma separated string od extendes tags // Command separated string of ...


3

WordPress is running addslashes on POST input. The value you get from the data base looks probably like: <img title=\"\" … … and the editor tries to enforce valid markup from that. So … call the editor with … wp_editor( stripslashes( $content ), strtolower($value['id']), $settings );


3

I copied your code into my functions.php, and added a simple admin panel ('Foo') to display the editor. Then I created a new directory inside my current theme for the editor button, and put the editor button JS into the relevant file: /wp-content/themes/[my-theme-dir]/tinymce_buttons/pH/editor_plugin.js. Result: when I went to Dashboard > Foo (the panel I'd ...


3

tinyMCE textarea is initially unseen by the used serialize function: $.post(ajaxurl, $('#addtag').serialize(), function(r){ .... you will need to call tinyMCE.triggerSave() to make it 'visible' a simple script with: jQuery('#submit').mousedown( function() { tinyMCE.triggerSave(); }); should do the trick. This in an external file, enqueued ...


3

I was looking for a solution to place custom metabox above the default editor and i've found the solution to my old question (how to customize the default editor with the wp_editor)! The solution was to unset the default editor first. Then create another metabox to to place the content then use wp_editor to create new its new instance, simple isn't it? ...


3

If you want the contents of an option, variables, or anything for that matter to be treated like post content you'll need to call the post content filters. <?php echo apply_filters( 'the_content', $your_var ); ?> Your data is then treated in the same way as post content is, inline with the code sample you've posted, the call should go like this.. ...


3

I believe you want remove_editor_styles. Looks like it removes the theme support for editor styles. remove_editor_styles(); If you run that on your plugin's backend page before the editor boots, it should solve the problem. There might be a parameter you can pass to the editor functions, or a hook, but removing the editor style support for the effected ...


3

Short answer: Because there is a hidden widget where the TinyMCE appears first. Long answer (sorry, a very long answer): Go to the Codex and copy the example widget Foo_Widget to make sure we are talking about the same code. Now open your IDE (not an editor) and write a short testing widget as plugin. Starting with a minimal plugin header... <?php /* ...


3

Here is my solution: add_filter('the_editor_content', "firmasite_tinymce_style"); function firmasite_tinymce_style($content) { add_editor_style('assets/css/custom.css'); // This is for front-end tinymce customization if ( ! is_admin() ) { global $editor_styles; $editor_styles = (array) $editor_styles; $stylesheet = ...


2

After doing some more research I found out that my save function does not work well. I think I should apply wpautop and wptexturize to those entries. My save function looks like this: if ( 'save' == $_REQUEST['action'] ) { foreach ($options as $value) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } ...


2

It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using html_entity_decode here is a very simple demo class, take a look at how the field is created. if (!class_exists('wp_editor_meta_box')){ class wp_editor_meta_box{ ...


2

I ran into the same issue when making use of the new wp_editor function on an alchemy powered metabox. I did some searching and turned up a solution that makes use of "html_entity_decode". Take a look at the reference here: https://gist.github.com/1838037


2

A while later i decided to try it again... (needed it for a project) this time i went for clean jquery and i got it to work! here it is: the working & easy to use way to count words while they are being written inside a wp_editor both in the html editor and visual editor. <script type="text/javascript"> i=0; $(document).ready(function(){ // ...


2

It turns out that TinyMCE has it's own autop setting, so if you kill it before the sort and then put it back you should be good to go! Check out the autop setting handling in this snippet: <script> (function($) { // by default, wpautop will be true var wpautop = true; // this function wraps subsequent additions of TinyMCE ...


2

Yes, it's possible to set it to false. The full parameters list is in the file wp-includes/class-wp-editor.php. These are the default values for the $settings array when calling wp_editor( $content, $editor_id, $settings );: array( 'wpautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => 20, ...


1

To get the quicktags to show up, you need to re instantiate them within your ajax oncomplete handler. quicktags({id : 'editorcontentid'}); My ajax success handler looks like this; success: function(data, textStatus, XMLHttpRequest){ //append editor to dom $('#container').append($(data).html()); //init quicktags ...


1

The "bold" icon on the visual editor is represented by a <span> with the class of mce_bold. You can target it using jQuery pretty easily and add a tooltip: jQuery('.mce_bold').attr('title', 'Please use an H2 tag instead.'); If you want to target it inside the HTML editor as well, use this code instead: jQuery('.mce_bold, ...


1

My approach was similer to @Bainternet's. The circumstances were slightly different however. Long story short, I had multiple buttons that opened the Add Media window and it was breaking the default TinyMCE functionality. Create an object that stores 2 items: var $state_manager = { active_item : 'null', default_send_to_editor: ...


1

I just put window.send_to_editor's function in .click() function $('#upload_button_1').click(function() { tb_show('','media-upload.php?type=image&amp;TB_iframe=true'); window.send_to_editor = function(html) { imgurl = jQuery('img',html).attr('src'); ...


1

Git this to work by using the following line of code in my theme's functions.php. $wordcount = str_word_count( strip_tags( $content ), 0 ); I got this piece of code from a stackoverflow post. The only disadvantage with this code is that it does not update dynamically which is not a big issue as the current wordcount will show up every time the post is ...



Only top voted, non community-wiki answers of a minimum length are eligible