Trouble adding JavaScript in visual editor (Sharpspring embed code)

You need the unfiltered_html capability to write JavaScript in post content. This is granted by default to administrators and editors. The better way would be to write a small plugin that provides you a shortcode: <?php /** * Plugin Name: WPSE 234978 – Provide shortcode for Sharpspring embed * Plugin URL: http://wordpress.stackexchange.com/q/234978/31323 * License: MIT … Read more

Convert this textarea to rich html format via wp_editor

You basically have two options, using PHP or Javascript. With PHP you would use the wp_editor function to output the textarea for you, and with Javascript you would convert the existing textarea with wp.editor.initialize. Note there are slightly different settings available for each approach. PHP wp_editor function in Codex $id = ‘yith_vendor_biografia’; $content = esc_textarea( … Read more

Preserving tabs and line breaks in when switching from HTML to Visual Editor

Add to function.php add_filter(‘tiny_mce_before_init’, ‘tiny_mce_before_init’); And function tiny_mce_before_init: function tiny_mce_before_init($init) { $init[‘setup’] = “function(ed) { ed.onBeforeSetContent.add(function(ed, o) { if ( o.content.indexOf(‘<pre’) != -1) { o.content = o.content.replace(/<pre[^>]*>[\\s\\S]+?<\\/pre>/g, function(a) { return a.replace(/(\\r\\n|\\n)/g, ‘<br />’); }); } }); }”; return $init; } http://core.trac.wordpress.org/ticket/19666 – it’s known bug, there is workaround but not fix tabs only new line … Read more

Close TinyMCE plugin window on click away

You asked the question a long ago but I was looking for something similar and found a solution. Enqueue an admin side script on post edit screens(where we have tinyMCE). Then use the code below: (function($) { ‘use strict’; $(document).ready(function() { $(document).on( ‘click’, ‘#mce-modal-block’, function() { tinyMCE.activeEditor.windowManager.close(); }); }); })(jQuery); This way you can close … Read more

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