How to disable TinyMCE 4 keyboard shortcuts

Re answer cited by the OP: Edited to add meta and access and other. The custom_shortcuts flags mentioned was in tinymce 3.x (see here) but was removed from 4.x, and on scanning the source nothing equivalent seems to have been substituted. The foo function method mentioned can still be used. In your theme’s “functions.php”: add_action( … Read more

Apply custom style to single word in WordPress

Solved it… In my functions.php I should have put: array( ‘title’ => ‘Hidden Element’, ‘inline’ => ‘span’, ‘classes’ => ‘hiddenElement’, ‘wrapper’ => false, ), not array( ‘title’ => ‘Hidden Element’, ‘block’ => ‘span’, ‘classes’ => ‘hiddenElement’, ‘wrapper’ => false, ), as here: http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-styles-to-wordpress-visual-editor/

Snippet: Use classes instead of inline styles for text alignment

Note This answer was originally included in @bitstarr‘s question above and was included as a separate answer here to comply with WPSE’s Q&A model. Maybe someone else will have this issue and so i will share my solution here with you folks. function make_mce_awesome( $init ) { /* There are easier things than make ‘left/center/right … Read more

Using a dashicon for a custom button in TinyMCE?

Here’s your easy solution (hopefully this will help other people too): 1) add a custom class for icon, in this example “myicons” (function () { tinymce.PluginManager.add(‘twitter_button_plugin’, function (editor, url) { editor.addButton(‘mce_tweet_button’, { title: ‘Insert tweet’, icon: ‘myicons dashicons-twitter’, onclick: function() { … } }); }); })(); 2) Enqueue your admin stylesheet file function load_custom_wp_admin_style() { … Read more

Add button in TinyMCE editor to insert text

Add this to your plugin file or in functions.php file in the theme directory add_action( ‘admin_enqueue_scripts’, ‘wpse_141344_admin_enqueue_scripts’ ); add_action( ‘admin_head’, ‘wpse_141344_add_mce_button’ ); function wpse_141344_admin_enqueue_scripts() { wp_enqueue_script( ‘wpse_141344-tinymce-scipt’, ‘url/to/your/custom-tinymce.js’ ); } function wpse_141344_add_mce_button() { if ( ! current_user_can( ‘edit_posts’ ) && ! current_user_can( ‘edit_pages’ ) ) { return; } add_filter( ‘mce_external_plugins’, ‘wpse_141344_add_tinymce_plugin’ ); add_filter( ‘mce_buttons’, ‘wpse_141344_register_mce_button’ … Read more

Disable text tab on WordPress text-editor

For disabling the text tab for all users except administrators, you can add the following: function my_editor_settings($settings) { if ( ! current_user_can(‘administrator’) ) { $settings[‘quicktags’] = false; return $settings; } else { $settings[‘quicktags’] = true; return $settings; } } add_filter(‘wp_editor_settings’, ‘my_editor_settings’);

Detecting when TinyMCE is “ready”

Unless your WP version is truly ancient, you should be able to use the tinymce-editor-init event triggered on editor init by “wp-includes/js/tinymce/plugins/wordpress/plugin.js”, eg (assuming your script is loading after jQuery): jQuery( document ).on( ‘tinymce-editor-init’, function( event, editor ) { // Blah. });

Creating a custom MCE view for your shortcodes [closed]

I had a lot of trouble finding information and examples of this, so here you go: https://github.com/dtbaker/wordpress-mce-view-and-shortcode-editor This converts a [shortcode] into a nice custom view to match the frontend, and adds an edit button for easy shortcode editing. <?php /** * Class dtbaker_Shortcode_Banner * handles the creation of [boutique_banner] shortcode * adds a button … Read more

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