Created
July 15, 2020 23:42
-
-
Save acf-extended/e4404d7ca0412ae162a960469e70abf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* TinyMCE: Add Tailwind CSS style | |
*/ | |
add_editor_style('/assets/css/tailwind.min.css'); | |
/* | |
* TinyMCE: Remove WP styles | |
*/ | |
add_filter('mce_css', 'my_tinymce_remove_stylesheets'); | |
function my_tinymce_remove_stylesheets($stylesheets){ | |
$stylesheets = explode(',', $stylesheets); | |
foreach($stylesheets as $key => $sheet){ | |
if(!preg_match('/wp\-includes/', $sheet)) | |
continue; | |
unset($stylesheets[$key]); | |
} | |
$stylesheets = implode(',', $stylesheets); | |
return $stylesheets; | |
} | |
/* | |
* TinyMCE: Remove the hardcoded 'lightgray' skin style | |
*/ | |
add_filter('tiny_mce_before_init', 'my_tinymce_remove_hardcoded_skin'); | |
function my_tinymce_remove_hardcoded_skin($init){ | |
$init['init_instance_callback'] = '' | |
. 'function(){' | |
. ' jQuery("#content_ifr").contents().find("link[href*=\'content.min.css\']").remove();' | |
. '}'; | |
return $init; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment