Your are absolutely right in principle. However in this particular case I need the styles to be loaded to the front-end, and not just in the admin area.
The all point is letting people use and apply custom styles trough the WYSIWYG editor so they can be “interpreted” in the front-end to the general public.
If my styles or scripts were only to be used in the admin area, then, admin_init (or eventually admin_head) were indeed the correct hooks to use.
Thanks!
MAC
Thanks for your warnings.
I’ve updated the code to your suggestions, except for point 1, where I haven’t had the time, yet, to check.
Thanks!
MAC
Nice guide, still i think there are some proablems.
1. the line below is useless, and should be deleted.
add_filter( ‘mce_css’, ‘tdav_css’ );
2. the following line:
wp_enqueue_style( ‘myCustomStyles’, get_bloginfo(‘template_url’).’/mycustomstyles.css’, ”,”’,’all’ );
would work better if changed in:
wp_enqueue_style( ‘myCustomStyles’, get_bloginfo(‘stylesheet_directory’).’/mycustomstyles.css’, ”,”’,’all’ );
3. the following line should be added. it helps make the editor look like the custom css.
add_editor_style(‘mycustomstyles.css’);
Your guide plus my changes worked graite for me. I hope it will help others.
Thx for the guide.
/**/
]]>