Add php function into .js file (for tinyMCE button)

To ajax this function you have hook it, so your function will be like this : function write_cat_list($cat){ $cats = get_categories(‘hide_empty=0’); if($cats) : $tinyMCE_list = array(); foreach ($cats as $cat) : $tinyMCE_list[] = array( ‘text’ => $cat->name , ‘value’ => $cat->term_id ); //write_cat_list($cat->term_id); endforeach; $jscode = json_encode($tinyMCE_list); //to convert from array to opject echo $jscode; … Read more

tinymce modal and I18n strings methods

While I can’t see any major fault in doing the way I proposed initially especially in relation to translation and localization, what I realised while researching this issue was that I was asking an ajax question. Basically what’s the most efficient method to initialize the I18n components of wordpress. Short of making a custom ajax … Read more

Inline Editing with wp_editor and tinymce (problem with textarea)

I am still experiencing with this, but here is how I got rid of the unwanted text area: if ( !is_admin() ) { //you might decide to change this conditional statement. //I found the filter in /wp-includes/class-wp-editor.php @249 add_filter(‘the_editor’, ‘my_remove_editor_te’); function my_remove_editor_te(){ $editor=””; return $editor; // or simply return; } } Here is how I … Read more

Is it better practice to create many page templates, or a a few base templates with custom HTML added via TinyMCE?

I use multiple templates, but also use code for some pages. For example, if I have a site with 3 sections, About, Products, and Research I would create page-about.php, page-products.php and page-research.php. These can be customized as necessary though usually they are simply pulling in unique sidebars which I want to include on all pages … Read more

TinyMCE HTML Encode Backslash

ok so finally found a solution to this. i had to edit class-wp-editor.php and include the following for the $first_init array ‘setup’ => ‘function(ed) { ed.onGetContent.add(function(ed, o) { // Replaces all a characters with b characters o.content = o.content.replace(/\\\\/g, “\”); }); }’,