Site logo

Archived topic

Block Editor Width

7 replies · Started by Math on February 1, 2022

Viewing posts 1–8 of 8

Hi,

After today's update (GeneratePress 3.1.2) the block editor is now displaying the post content in (almost) full width. Previously, it was contained and you could tell the difference between full width and contained widths.

The actual post when Previewing or Publishing works as intended. It's only in the editor.

Why was it changed?

Thank you.

Hi there,

WP 5.9 stopped the Full Width block options being displayed in the Post Editor. Which was patched in 3.1.2.
So the only change should be related to blocks with that option selected.

Are you seeing a change elsewhere ?

Would it be possible to get temporary admin access to the problem site so we can take a look ?

Login info provided.

Hi there,

Sorry about this - looks like a bug when setting the content width in a Layout Element and our 3.1.2 update.

As a quick fix until we release 3.1.3, you can do this:

add_action( 'enqueue_block_editor_assets', function() {
	global $generate_elements;

	foreach ( $generate_elements as $element ) {
		if ( 'layout' === $element['type'] ) {
			$content_width = get_post_meta( $element['id'], '_generate_content_width', true );

			if ( $content_width ) {
				$admin_css = 'body .wp-block{max-width: ' . absint( $content_width ) . 'px !important;}';
				wp_add_inline_style( 'generate-block-editor-styles', $admin_css );
			}
		}
	}
}, 100 );

Let me know if that works or not :)

Hi Tom,

Seems to be working. Thanks for addressing this issue quickly!

No problem - sorry for the inconvenience!

This archived topic is closed to new replies.