Add Wrapper with Class to WYSIWYG Editor

Here’s the approach that I use. I add a single class (typically .entry-content) to the WP Editor on the back end as well as to the wrapper element when I output content on the front end. style.css .entry-content h2 { color: purple; } /* etc … */ I’m also using add_editor_style() to load my theme’s … Read more

Limit Block format tags in WordPress wp_editor

You need to add formatselect in one of the toolbars, and WordPress by default have it in toolbar1: wp_editor( $content, ‘fm_display_callback’, array( … ‘tinymce’ => array( ‘toolbar1’ => ‘formatselect,bold,italic,…’, … ), ) ); Check this and https://www.tiny.cloud/docs-4x/configure/content-formatting/#block_formats.

Add a select a class dropdown in tinymce

To achieve the dropdown styles we have to use the filter hook tiny_mce_before_init. This filter grants developers access to the TinyMCE settings array. The following example adds custom style options to an existing Style dropdown. add_filter( ‘tiny_mce_before_init’, ‘my_mce_before_init’ ); function my_mce_before_init( $settings ) { $style_formats = array( array( ‘title’ => ‘1/5 Block’, ‘block’ => ‘div’, … Read more

Preserving tabs and line breaks in when switching from HTML to Visual Editor

Add to function.php add_filter(‘tiny_mce_before_init’, ‘tiny_mce_before_init’); And function tiny_mce_before_init: function tiny_mce_before_init($init) { $init[‘setup’] = “function(ed) { ed.onBeforeSetContent.add(function(ed, o) { if ( o.content.indexOf(‘<pre’) != -1) { o.content = o.content.replace(/<pre[^>]*>[\\s\\S]+?<\\/pre>/g, function(a) { return a.replace(/(\\r\\n|\\n)/g, ‘<br />’); }); } }); }”; return $init; } http://core.trac.wordpress.org/ticket/19666 – it’s known bug, there is workaround but not fix tabs only new line … Read more

Set tinymce direction to rtl

In wordpress, the editor will support and will be in RTL by default if you install it in an rtl language, for example, if you install wordpress with the hebrew UI the editor will be rtl by default. The problem is if you install the hebrew UI but change your profile to use the English … Read more

Is there a way to remove the default css from TinyMCE?

You should be able to remove these by hooking into the mce_css filter in your functions.php file: add_filter(“mce_css”, “my_remove_mce_css”); function my_remove_mce_css($stylesheets){ return “”; } I haven’t tested this but it should work. You might want to echo out the value of $stylesheets before you return nothing just to see what else is coming through – … Read more

Sortable WYSIWYG editor

I pointed you to my work in chat, but for any other user, I have solved repeatable, sortable tinyMCE editors (as best as I could) and have the code available on github. Specifically, the JS script which includes a section on how to disable tinyMCE on the start of a sortable move and re-enable it … Read more

How to stop editor removing space ( ) in the beginning of the paragraph

//[nbsp] shortcode function nbsp_shortcode( $atts, $content = null ) { $content=”&nbsp”; return $content; } add_shortcode( ‘nbsp’, ‘nbsp_shortcode’ ); Then call it like this: [nbsp] Instead of: &nbsp; Hat tip to this post on wordpress.org: https://wordpress.org/support/topic/prevent-nbsp-characters-from-getting-removed-by-the-visual-editor

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