wp_editor disable after reaching character count limit

I guess the keyup event is too late. If you use the keypress event instead of keyup, then this seems to work: ed.on( ‘keypress’, function(e) { var content = ed.getContent().replace( /(<[a-zA-Z\/][^<>]*>|\[([^\]]+)\])|(\s+)/ig, ” ); var max = 20; var len = content.length; var diff = max – len; if ( diff < 1 ) tinymce.dom.Event.cancel(e); document.getElementById(“character_count”).innerHTML … Read more

WordPress 3.2 has broken my TinyMCE code

I found some info on changes in 3.2 that might be relevant: Aparrently, wp_tiny_mce_preload_dialogs() no longer exists from WP3.2 on. It got replaced by wp_preload_dialogs() which is now being called from wp_quicktags(). wp_quicktags, on his turn, is being called from the_editor() function. So, if you’re using the_editor() you no longer need to manually call the … Read more

Custom Tiny MCE button to bring up a custom php popup

This works: tinymce.create(‘tinymce.plugins.tinyplugin’, { init : function(ed, url){ ed.addButton(‘tinyplugin’, { title : ‘map’, onclick : function() { tb_show(“”, “../wp-content/plugins/myplugin/test.php?”); tinymce.DOM.setStyle([“TB_overlay”, “TB_window”, “TB_load”], “z-index”, “999999”) }, image: url + “/icon.png”, }); } }); The ? after the test.php is important or else the link will be broken.

TinyMCE custom styles remove class when switching styles

Seems the question was asked at community.tinymce.com and the answer is here: https://community.tinymce.com/communityQuestion?id=90661000000IiyjAAC You can’t make the style you’ve defined remove any previous classes, but what you can do is ‘apply’ the style again by selecting it from the dropdown list and it will be removed – i.e. the class will be removed from the … Read more

Possible to stop WordPress from adding p1, p2… classes to p tags in TinyMCE?

I figured out how to strip those classes using TinyMCE’s paste_preprocess option. In your functions.php: add_filter(‘tiny_mce_before_init’, ‘customize_tinymce’); function customize_tinymce($in) { $in[‘paste_preprocess’] = “function(pl,o){ o.content = o.content.replace(/p class=\”p[0-9]+\”/g,’p’); o.content = o.content.replace(/span class=\”s[0-9]+\”/g,’span’); }”; return $in; } The value passed to paste_preprocess is a JavaScript function which will be executed whenever content is pasted into TinyMCE. The … Read more

TinyMCE in customizer

SwAt.Be, your own answer helped me a bunch and I’ve nailed the problem of printing admin scripts after the last rendition of wp_editor. Also see how I pass JS setup function as tinymce option to sync the editor changes with WP customizer to make it work properly. if (class_exists(‘WP_Customize_Control’)) { class WP_Customize_Teeny_Control extends WP_Customize_Control { … Read more

Stop certain classes showing up in TinyMCE Advanced Style dropdown

This should be what you’re looking for – put this code into your theme’s functions.php file: add_filter( ‘tiny_mce_before_init’, ‘yourprefix_tiny_mce_before_init’ ); function yourprefix_tiny_mce_before_init( $init_array ) { // filter styles: $init_array[‘theme_advanced_styles’] = “your_style=your_class”; // filter formats: $init_array[‘theme_advanced_blockformats’] = “p,h3,h4,h5”; return $init_array; } This way the only style that will be displayed is your_style. The 3rd line is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)