How to add css to just editor view
-
I’m building a site (no link yet, still on my desktop) based on TTT and I have a number of CSS animations that fade in from opacity 0 when they enter the viewport (triggered by js observer). but this doesn’t happen when in editor view (Appearance > Editor > Pages nor Appearance > Editor > Pages > [specific page or template or part]
in the old theme method, you could shimmy an editor.css stylesheet into the backend view like so
function themename_execute_on_edit_new_views($hook) {
// Check if we are on a post add or edit screen
if (‘post.php’ === $hook || ‘post-new.php’ === $hook) {
wp_enqueue_style(‘themename-admin-styles’, get_theme_file_uri(‘editor.css’), false, ‘1.0’, ‘all’);
}
}add_action(‘admin_enqueue_scripts’, ‘themename_execute_on_edit_new_views’);
Is there some way to inject custom css to just the Editor views? I don’t want to bloat up my front end CSS with editor only styles.
- The topic ‘How to add css to just editor view’ is closed to new replies.