Change the Content and Wide Widths of a Block Theme
Sets how wide normal and "wide" content is in your block theme, on the site and in the editor, for example a narrower reading column with wider images.
Opens WPIDE on
Code
// Width of normal content and of wide-aligned blocks.
$wpide_content_size = '720px';
$wpide_wide_size = '1200px';
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) use ( $wpide_content_size, $wpide_wide_size ) {
return $theme_json->update_with( array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
'settings' => array(
'layout' => array(
'contentSize' => $wpide_content_size,
'wideSize' => $wpide_wide_size,
),
),
) );
} );
Notes
Values can be px, rem or %. Changes made in the Site Editor's Styles still take priority.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.