Site logo

Archived topic

Use generate_settings container_width for Gutenberg Editor

13 replies · Started by David Perez Garcia on December 22, 2020

Viewing posts 1–14 of 14

Hello,
It should be nice that some things from frontend should go to the Gutenberg Editor. Like generate_settings - container_width, typography...

How could I do it? or Are you planning to put it in nexts versions?

Hi there,

GP already does that by default, check that you have Use Theme Styles enabled, you will find this in the editor 3 dot menu ( top right ) > Preferences > Appearance.

If that is enabled and you are still not seeing the styles then another function or plugin is disabling that.

Yes, ok I do and is activated.

But my container in editor still in 1470, but my container in customizer is 1000px.

Hi there,

It's hard to tell without seeing it, but it could be another plugin altering the width of the content.

Can you link us to the front-end of the page in question?

It happens in all websites. I share with you one.

Is there a specific page I should be looking at?

Any page. It does not contain the CSS of the theme and the settings of the customizer.

How could add Additional CSS to Gutenberg Editor?

You can add the Additional CSS to the editor like this:

add_action( 'enqueue_block_editor_assets', function() {
    wp_add_inline_style( 'generate-block-editor-styles', wp_get_custom_css_post()->post_content );
} );

Perfect! thanks!

You're welcome :)

Hello Thomas, I get an error with that shortcode:
Warning: Attempt to read property "post_content" on null

I use child theme.

I use child theme.

I assume you've added it to a child theme's functions.php ?

Can you share a screenshot of the error and the contents of the functions.php file?

This archived topic is closed to new replies.