Skip to content

Instantly share code, notes, and snippets.

@JPry
Forked from jtsternberg/add-editor-style.php
Last active August 29, 2015 14:27
Show Gist options
  • Save JPry/a2fcad3b0d1fee2b915a to your computer and use it in GitHub Desktop.
Save JPry/a2fcad3b0d1fee2b915a to your computer and use it in GitHub Desktop.
add editor style (works for front-end editors as well)
<?php
add_filter( 'mce_css', 'jpry_add_editor_styles' );
/**
* Filter the TinyMCE styles.
*
* @param string $styles The comma-separated list of stylesheets to be loaded by TinyMCE.
*
* @return string The updated comma-separated list of stylesheets to be loaded by TinyMCE.
*/
function jpry_add_editor_styles( $styles ) {
$new_styles = array(
get_stylesheet_directory_uri() . '/editor-style.css',
);
// Add our styles to the array
$styles_array = array_merge( explode( ',', $styles ), $new_styles );
$styles = implode( ',', $styles_array );
return $styles;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment