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/

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

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

Remove “Are You Sure” dialogue when leaving editor

You can use the method described here. Add the following to your functions.php <?php function wpse35898_admin_head() { ?> <script type=”text/javascript”> window.onbeforeunload = function() {}; </script> <?php } add_action( ‘admin_head’ , ‘wpse35898_admin_head’ ); ?>

HTML5, WordPress and Tiny MCE issue – wrapping anchor tag around div results in funky output

[*] You need to modify the TinyMCE settings, specifically the valid_children setting. To accomplish this in WordPress, use the tiny_mce_before_init filter reference. Something like this (untested): add_filter(‘tiny_mce_before_init’, ‘modify_valid_children’); function modify_valid_children($settings){ $settings[‘valid_children’]=”+a[div|p|ul|ol|li|h1|h2|h3|h4|h5|h5|h6]”; return $settings; } You may be able to use +a[*] to capture all elements, but you’ll want to take care to avoid nested anchor … Read more

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