- This topic has 7 replies, 2 voices, and was last updated 3 years, 1 month ago by
David.
-
AuthorPosts
-
March 7, 2023 at 3:16 am #2558490
mkjj
Hi there,
I usually use the editor-style.css to make the classic editor as much WYSIWYG as possible. I’ve just found out that some default GP styles are not overwritten. I could use!important, but I would prefer a more elegant solution. Can I programmatically load the editor-style.css after the default CSS editor stylesheet (generatepress/assets/css/admin/editor-typography.css)?I use the standard code for loading the custom stylesheet:
add_editor_style(get_stylesheet_directory_uri() . '/editor-style.css?v=' . filemtime(get_stylesheet_directory() . '/editor-style.css'));(Versioning is added to prevent issues with caching.)
Thank you.
March 7, 2023 at 3:58 am #2558544David
StaffCustomer SupportHi there,
hmmm… no priority on the
add_editor_stylefunction.
You could try calling it later like so:add_theme_support( 'editor-styles' ); add_action('after_setup_theme', 'db_add_my_editor_styles'); function db_add_my_editor_styles() { add_editor_style(get_stylesheet_directory_uri() . '/editor-style.css?v=' . filemtime(get_stylesheet_directory() . '/editor-style.css')); }To cover, the
add_editor_styleincludes theadd_theme_support( 'editor-styles' );but i believe that needs to be called earlier thenafter_theme_setupso we call it first. Then make theadd_editor_stylecallback after the theme has loaded…Let me know.
March 7, 2023 at 4:48 am #2558593mkjj
No, it doesn’t work either. It seems that all editor-related stylesheets are loaded via javascript and cannot modified so easily. Could I completely deactivate the default editor stylesheet that comes with GP. I don’t really need it.
March 7, 2023 at 7:07 am #2558747David
StaffCustomer SupportWe stopped loading styles back with WP 5.9.
See here:https://docs.generatepress.com/article/classic-editor-styling/
So what are you seeing ?
March 7, 2023 at 7:30 am #2558771mkjj
I use the classic editor. Is the GP editor stylesheet loaded when the classic editor is activated? But it seems to be a different stylesheet. The loaded stylesheet is:
/generatepress/assets/css/admin/editor-typography.css
It contains only 66 lines of CSS.
March 8, 2023 at 4:43 am #2559893David
StaffCustomer SupportAah my bad, forgot about that.
Simple fix – is to add an empty style sheet:editor-typography.cssto your child theme.March 8, 2023 at 5:18 am #2559926mkjj
Hm, still not working. I tried it with the stylesheet in /gp-child/ and in /gp-child/assets/css/admin/editor-typography.css. But it works, if I change the stylesheet in /gp-child/assets/css/admin/editor-typography.css It’s not super ideal, since I have to edit two files. But that’s not too bad.
That’s ok?
Thanks, Mike
March 8, 2023 at 7:49 am #2560122David
StaffCustomer SupportThat is ok… ill have a look round to see if there is a better way, ill report back if i find one 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.