• Resolved Pawel Mansfeld

    (@mansfeld)


    Hello!

    Thank you for this wonderful plugin! I have a simple question. Is there any way to disable FullWidth Gutenberg Editor View for specified Post Types for example for Standard Blog Posts?

    Now we can Edit Pages in full-width View and that is cool because we use container, container-fluid and so on… For blog Posts full-width mode is unnecessary – is there a way to achieve that? Thank you in advance for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Miles

    (@areoimiles)

    Hi Pawel,

    I’m glad to hear you are enjoying the plugin (thanks again for leaving us such a positive review!).

    I just want to make sure I fully understand what you need. At the moment with All Bootstrap Blocks installed, content within the editor is 100% width, but for certain post types you want the content within the editor to be displayed in a fixed width (similar to how it works without All Bootstrap Blocks installed), is that right?

    Thanks

    Miles

    Plugin Author Miles

    (@areoimiles)

    Hi Pawel,

    I’ve wrote a function that should resolve your issue. If you add the below into your functions.php file and update accordingly you should get a fixed container for content on the specified post types and full width for any that aren’t specified.

    function override_editor_width_styles() 
    {
    	// Get current screen details
    	$current 			= get_current_screen();
    	
    	// Specify new max width for editor content
    	$max_width 			= '840px';
    
    	// Add custom post type slugs that you wish to override the width
    	$inc_post_types = array(
    		'post',
    		// Any additional post types that you wish to override
    	);
    
    	// Check current screen has a post type and is included in our allowed list of post types
    	if ( !empty( $current->post_type ) && in_array( $current->post_type, $inc_post_types ) ) {
    
    		// Add override styles
    		echo '<style>
    			.block-editor-block-list__layout.is-root-container .wp-block:not([class*=container]) {
    			    max-width: ' . $max_width . ';
    			}
    			.block-editor-block-list__layout.is-root-container .wp-block[data-align="wide"]:not([class*="container"]) {
    			    max-width: 100%;
    			}
    			.block-editor-block-list__layout.is-root-container .wp-block[data-align="full"]:not([class*="container"]) {
    			    max-width: none;
    			}
    		</style>';
    	}
    }
    add_action( 'admin_head', 'override_editor_width_styles' );

    Hopefully this solves your issue, but let me know if I have misunderstood and I will do my best to help.

    Thanks

    Miles

    Thread Starter Pawel Mansfeld

    (@mansfeld)

    Hi Miles,

    Wow! This is exactly what I was looking for. Thank you for quick response.

    Plugin Author Miles

    (@areoimiles)

    Hi Pawel,

    No problem at all. Thanks you for using our plugin, we hope you continue to enjoy it!

    Miles

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is there a simple way to disable full-width Gutenberg Editor for Posts?’ is closed to new replies.