TinyMCE custom button retrieve value from custom field

Rather than finding the custom field value when the user hits the button, change the [custom field value] to a shortcode name (perhaps “[mkay_subscription_button_value]”?) and then create a shortcode that can replace the value of that key with the post’s custom meta. Something like this: function 246286_display_custom_field( $atts ) { $data = get_post_meta( get_the_ID(), ‘mkay_custom_field’, … Read more

Custom styles in Tiny MCE with an external CSS file

The path to the CSS file tinymce.min.css was incorrect. The solution was to change: $url .= trailingslashit( plugin_dir_url(get_stylesheet_directory_uri()) ) . ‘/tinymce.min.css’; to: $StyleUrl = get_stylesheet_directory_uri().’/style-sheets/tinymce.min.css’; I also had to change: $StyleUrl = plugin_dir_url(get_stylesheet_directory_uri()).’tinymce.min.css’; to: $StyleUrl = get_stylesheet_directory_uri().’/style-sheets/tinymce.min.css’; Now all I had to do was to remove the styles array so the complete code is: // … Read more

How to add custom tinymce plugin to new text widget

I found the solution with help from Jacob Peattie and the article from https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/ Here’s a quick walkthrough on what i did: I made a new js file container the code of my original button, but modified it to the event listener of the widget tinymce jQuery( document ).on( ‘tinymce-editor-setup’, function( event, editor ) { … Read more

Translate MCE button text/tooltip in custom plugin

Create js file button.js and add js directory and list-btn.png needed (function() { tinymce.create(“tinymce.plugins.listbuttons_button_plugin”, { //url argument holds the absolute url of our plugin directory init : function(ed, url) { //add new button ed.addButton(“listbuttons”, { title : “Add Related post shortcode”, cmd : “listbuttons_command”, image : “images/list-btn.png” }); ed.addCommand(“listbuttons_command”, function() { var return_text = “[related]”; … Read more

More than one TinyMCE (wp_editor) with different $settings[‘drag_drop_upload’] values breaks

Not sure if this is a bug, but the behaviour is correct, or at least apparently intentional. a) There is only one dragDropUpload setting in the tinyMCEPreInit object, instead of one flag per editor. b) looking at class-wp-editor.php:139: if ( $set[‘drag_drop_upload’] ) { self::$drag_drop_upload = true; } so, if the setting is set to true … Read more

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