Insert dynamic listbox options in Tinymce popup editor

So the problem with the values helper was that it will only take array of objects and i was passing a string…I have corrected the code by passing an array of objects..Below is the corrected code.. body: [ { type: ‘listbox’, name: ‘type’, label: ‘Panel Type’, value: type, ‘values’: get_author_list(), tooltip: ‘Select the type of … Read more

TinyMCE Editor change underline button behavior – u tag instead of span text-decoration underline

After few days I got it to work. Gotta check those core files, now I know how. Anyways, here is the working code: function my_tiny_mce_tweaks( $first_init ) { $first_init[‘formats’] = ‘{‘ . ‘alignleft: [‘ . ‘{selector: “p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li”, styles: {textAlign:”left”}},’ . ‘{selector: “img,table,dl.wp-caption”, classes: “alignleft”}’ . ‘],’ . ‘aligncenter: [‘ . ‘{selector: “p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li”, styles: {textAlign:”center”}},’ . … Read more

Add drop down in wordpress tiny mce editor pop up

See here, I think it’s enough for making any kind of TinyMCE Editor button with extended options like dropdown etc https://www.gavick.com/blog/wordpress-tinymce-custom-buttons Anyway if we came down to dropdown, checkbox and radio button on Popup, here is a demonstration. (function () { tinymce.PluginManager.add(‘aptmce_btn’, function (editor, url) { editor.addButton(‘aptmce_btn’, { text: ‘Add popup’, icon: false, onclick: function … Read more

How to add button in TinyMCE TEENY mode?

I solved it this way: /** * Plugin Name: customp * Description: some * Version: 1.0.0 * License: GPL-2.0+ * Text Domain: customp * Domain Path: /languages */ add_action(‘admin_head’, ‘_20161201_admin_head’); function _20161201_admin_head() { global $typenow; // check user permissions if ( !current_user_can(‘edit_posts’) && !current_user_can(‘edit_pages’) ) { return; } // verify the post type if( ! … Read more

Add a TinyMCE Core Plugin Using tiny_mce_before_init

Sorry to answer my own question, but of course I figured it out right after posting this. Instead of tiny_mce_before_init I needed to use mce_external_plugins. Also, I had to download TinyMCE from their website and copy the plugins/advlist folder to WordPress. I created a folder called mce in my WordPress plugins directory and pasted the … Read more

Stop WordPress Visual Editor converting backticks into code blocks

This has solved the problem, simply remove the plugin which automatically formats text as you type, from loading in the first place. add_filter( ‘tiny_mce_plugins’, ‘rwebster_editor_remove_wptextpattern’, 1, 99 ); function rwebster_editor_remove_wptextpattern( $plugins ) { $wptextpattern = array_search( ‘wptextpattern’, $plugins ); unset( $plugins[$wptextpattern] ); return $plugins; }

How to reset ‘Advance’ tab on table property?

To customize default styles: $styles = array(‘width’=>’100%’); $settings[‘table_default_styles’] = json_encode($styles); To disable advance tab: $settings[‘table_advtab’] = false; Complete code at functions.php: function bootstrap_classes_tinymce($settings) { // to customize more please visit: https://www.tiny.cloud/docs/plugins/table/#table_default_styles // Add bootstrap class inside <table> tag $classes = array( array( ‘title’ => ‘None’, ‘value’ => ” ), array( ‘title’ => ‘Table’, ‘value’ => … Read more

wp.editor.initialize does not show the same default toolbar

Please Add this code for same layout for wp wp.editor.initialize(editor_id,{ tinymce: { wpautop: true, plugins : ‘charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern’, toolbar1: ‘formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv,listbuttons’, toolbar2: ‘styleselect,strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help’, textarea_rows : 20 }, quicktags: {buttons: ‘strong,em,link,block,del,ins,img,ul,ol,li,code,more,close’}, mediaButtons: false, });

TinyMCE Visual Blocks plugin set Show blocks option for all users

Just add this code to functions.php of your theme and then “View” –> “Show blocks” will always be enabled immediately when the page loads if( !function_exists(‘custom_settings_tinymce’) ){ function custom_settings_tinymce($init) { $init[‘visualblocks_default_state’] = true; return $init; } add_filter(‘tiny_mce_before_init’, ‘custom_settings_tinymce’ ); }