-
I have this custom css:
#ftwp-postcontent h2 { border-bottom: 1px solid #a2a9b1; }
but it only show correct in frontend, I want to show in my editor
How can I do that?
-
David
Hi there,
where are you adding the CSS ? eg. the Customizer > Additional CSS or the Child Theme.
-
I add to : Customizer > Additional CSS
-
David
Add this PHP Snippet to your site, and it will tell WP to load those styles in the editor:
add_filter( 'block_editor_settings_all', function( $editor_settings ) { $css = wp_get_custom_css_post()->post_content; $editor_settings['styles'][] = array( 'css' => $css ); return $editor_settings; } );
Adding PHP:
https://docs.generatepress.com/article/adding-php/ -
I added filter, and it don’t show in editor.
After that, I add more CSS (.editor-styles-wrapper_:
#ftwp-postcontent h4, .editor-styles-wrapper h4 { font-style: italic; }
And it still not show in editor
-
David
What block in the editor has this ID
#ftwp-postcontent
? -
#ftwp-postcontent this is id at frontend content (content body)
-
Fernando
Hi Vovi,
Can you try using a class selector in your CSS instead of an ID to test?
-
I changed my css to:
#ftwp-postcontent h4, .editor-styles-wrapper h4, .entry-content h4 { font-style: italic; }
It still not show in my editor
-
Fernando
Can you try editing it to this to test?:
#ftwp-postcontent h4, .editor-styles-wrapper h4, .entry-content h4 { font-style: italic !important; }
-
I tried, but it don’t work too
-
Fernando
Do you have a caching/optimization plugin? If so, can you disable that first?
Also, may we know how you added the PHP snippet? Did you use a plugin called Code snippets for instance?
-
I cleared cache, but it still not work
I using Code snippets to add your filter.
-
Fernando
Is the code working on the frontend?
Can you share the link to the site in question?
-
It is working on the frontend.
https://udumbara.org/pipa-a-wonderful-sound-from-the-heaven/
-
Fernando
Can you provide admin login credentials through the Private Information field?
- You must be logged in to reply to this topic.