Remove HTML editor and visual/HTML tabs from TinyMCE
Just set ‘quicktags’ parameter of the settings array to false. wp_editor(”, ‘some-id’, array(‘quicktags’ => false) );
Just set ‘quicktags’ parameter of the settings array to false. wp_editor(”, ‘some-id’, array(‘quicktags’ => false) );
So I’m answering my own question, for those that face or will face the same problem. I have added two buttons. One opens wordpress’ build-in window to select a post and inserts the link. The other opens wordpress’ build-in media window to select an image. That is what somehow what you get at the end. … Read more
Solution 1 This works as javascript solution: Example: tinyMCE.activeEditor.dom.addStyle(‘p {color:red; font-size:28px;}’); just open your js console and paste it for a quick test. To target a specific editor one should use: tinyMCE.getInstanceById(‘##editorID##’).dom.addStyle(‘p {color:red; font-size:28px;}’); This will inject the provided string into the editors iframe <head><style id=”mceDefaultStyles”></style> … Solution 2 Use wp_ajax as callback handler to … Read more
The main problem are the missing scripts. The scripts enqueued in _WP_Editors::enqueue_scripts() are never printed. The same is true for _WP_Editors::editor_js(). So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: T5 AJAX Editor. There is one class named Ajax_Editor. Its method render() … Read more
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’ => 4, ‘tinymce’ => array( … Read more
The following small plugin creates a custom button inside line 1 of the WordPress TinyMCE Version 4, tested in WP Version 3.9-beta2. The plugin has var_dump included to understand the values. It’s also possible to add the button to other lines of the visual editor, only a other hook, like for line 2: mce_buttons_2. Result … Read more
Alright so I’ve already updated this question a ton and it’s starting to get overloaded, so I figured I’d write this as an answer even though it isn’t a full one. Extrapolating from @bueltge’s answer, I actually went back and found his previous post in question. In that post, there was a plugin listed that … Read more
I recently got this working. You should search and replace metaname with your meta box name. The key to maintaining formatting was using wpautop(); when saving the data. add_action( ‘add_meta_boxes’, ‘add_metaname_box’); add_action( ‘save_post’, ‘metaname_save’); function add_metaname_box() { add_meta_box( ‘metaname_id’, __( ‘metaname text’, ‘metaname_textdomain’), ‘metaname_custom_box’, ‘page’ ); } function metaname_custom_box() { global $post; wp_nonce_field( plugin_basename( __FILE__ … Read more
You can not enhance the drop-down list formatselect. But you can enhance with the hook tiny_mce_before_init the second drop down styleselect, there is to hide in a default WordPress install. The documentation list all defaults and possibilities. inline – Name of the inline element to produce, for example “span”. The current text selection will be … Read more
Here’s a way to test the core patch #33300.6 by Andew Ozz, through a test plugin in WP 4.5.2, to try out the text pattern filter. Demo Here’s a strikethrough example using ~ $init[‘wpsetextpattern_inline_patterns’] = ‘{ strong: { start: “*”, end: “*”, format: “bold” }, strong2: { start: “**”, end: “**”, format: “bold” }, em: … Read more