13 Sep
2012
Posted in: Code, WordPress
By    No Comments

Add your blog / custom style sheet to WordPress text / tinymce editor

For a while now I have wondered how easy it would be to add a custom style sheet to the WordPress text / tinymce editor. It sometimes seems hard for clients to relate to their main site when editing text via WordPress as the styles are so different.

After a bit of Googling I found the following code which if placed inside the functions.php file of your theme, add a custom style sheet to the editor.

{code type=php}
if ( ! function_exists(‘tdav_css’) ) {

function tdav_css($wp) { $wp .= ‘,’ . get_bloginfo(‘stylesheet_url’); return $wp; }

}

add_filter( ‘mce_css’, ‘tdav_css’ );

{/code}

I found this code at the following link http://wordpress.org/support/topic/how-do-i-add-custom-stylesheets-to-tinymce and it worked for me in WordPress Version 3.4.2

So, what do you think?

*