Because the WordPress hook add_theme_support( 'editor-styles' );
adds the css in the style-editor.css and appends the class .editor-styles-wrapper
before my .wp-block
, the usage of the body classes for page vs. post styles fails. Instead I use the answer from here, from David Walsh, to add the styles independently to the wp admin area:
// Update CSS within in Admin
function admin_style() {
wp_enqueue_style('admin-styles', get_template_directory_uri().'/style-editor.css');
}
add_action('admin_enqueue_scripts', 'admin_style');
Css code, as answered by @RiddleMeThis, works well now and I can differentiate between the post/page types:
@media (min-width: 600px) {
/* Main column width - pages */
.post-type-page .wp-block { width: 90%; max-width: 1170px; }
/* Main column width - posts */
.post-type-post .wp-block { width: 60%; max-width: 800px; }
}
Related Posts:
- How to add a custom CSS class to core blocks in Gutenberg editor?
- How would one modify the filtering Gutenberg applies to pasted content?
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to filter users on admin users page by custom meta field?
- is it possible to add “extra” table nav to edit-tags.php screens?
- How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table elements?
- What hook do I use to edit the post statuses option in admin?
- post_mime_types Filter not Working in List Mode
- Changing text within the Block Editor
- Adding a class to the body_class function
- Remove left alignment option in core/image block
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- WordPress Rest filter for custom taxonomy gets applied to the admin area
- user_has_cap filter allows edit but will not allow save
- Gutenberg Block Editor Match Admin Styles & Frontend Styles
- Add classname to the_category() function?
- Filter Gutenberg Blocks Content
- How to remove google font in WordPress for only single page?
- How do I replace a render_callback function for a block?
- How can I filter block registration based on post-type? (Block alignment settings)
- Gutenberg disable the “block” tab in right sidebar
- Why my admin doesn’t work after adding rest_prepare_post filter?
- Where is this inline CSS code [closed]
- How to center oEmbedded content
- Add Sortable Column For All Post Types
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- How to change the order of HTML output of a core block?
- How to add ‘total’ value to custom column title on the posts list page
- Different css rules for TinyMCE and Gutenberg while using add_editor_style()
- Remove CSS & JS files from WordPress Main Page For Increase Pagespeed?
- Gutenberg – Add align controls to a custom block
- Can the wordpress color palettes by changed through Javascript?
- Header image automatically changes depending on season
- Inline Styles on all native blocks
- How to link the whole list item in Gutenberg’s latest posts block?
- add_filter(allowed_block_types) -> adding core/paragraph bugs Gutenberg editor
- Set default terms for new posts / CPTs
- How to apply a CSS file to my admin pages?
- views_edit-post filter not working (custom post type)
- Filter out comments with certain meta key/s in the admin backend
- Filter pre_get_posts does not modify Mine/All/Pending
- Detect when gutenberg editor title is available in Dom after editor load
- Gutenberg Block – Post Featured Image Filter Hook
- Set default value for “Additional CSS class(es)” for specific block types
- Prevent add_filter being applied to wp-admin pages
- How to add attributes to WordPress Admin Sub Menu List Items
- Media upload default title from file name
- Change login CSS
- Admin post list – adding an option to the date filter dropdown
- How to replace username with email address in users table
- How to hide/remove GhostKit component panel in gutenberg block inspector
- Filter for author list in gutenberg core editor
- Hide Posts In Back-end/Admin Based On User’s (Pseudo) Privileges Controlled by ACF
- Filter Pages by Custom Field (ACF) in admin area
- Echo string in admin panel footer beside version no
- Filter / add_action to upgrade.php page
- How to filter with dropdown in backend for custom data
- ACF Gut block broke wordpress default style?
- How to optionally append components to the output of a gutenberg block?
- Problem width wp_insert_post_data and Gutenberg block editor
- WordPress Sudden Loss of All CSS And Tons of JQuery Errors
- WordPress Gutenberg core/heading block (wp-block-heading)
- Changing the category for existing Gutenberg blocks
- Stop custom Gutenberg styles taking over other admin bits?
- How do I check if I can use the allowed_block_types filter?
- Add an attribute to the root from functions.php with add_filter
- Having wp-admin on different domain
- How to add lazy field in content endpoint using Gutenberg blocks
- WordPress: Issue with filtering users using date range
- Style Radio Buttons inside Edit Page (Custom Fields)
- How do I disable the warning “The backup of this post in your browser is different from the version below”?
- Publish button inside custom field group
- custom css in admin panel by user id
- theme injecting css into wp-admin
- Where are the Parent themes CSS & PHP files hidden on WordPress?
- How to add custom HTML attribute to reusable block div in WordPress admin
- How to change this WP logo and posts url in block editor?
- This code works, but breaks the media uploader. How do I integrate it in a way that won’t?
- Background color and background image below element in Contact Form 7 – error tip [closed]
- Valid characters for actions, hooks and filters
- How do I use the ‘http_request_host_is_external’ filter
- AJAX filter posts on click based on category
- How do I know if author field was changed on post save?
- Some questions regarding filter
- Which hook is fired when inserting media into a post
- How do I filter get_the_excerpt() but keep all of its functionality intact?
- How to add a class to Tag cloud widget link?
- Is there a get_post(s) filter that can alter/replace the output completely?
- add_filter does not work as expected
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- Formatting get_post content doesn’t allow JS content to function properly
- How can I change the email that is inside the default email texts of wordpress?
- Modify message displayed on post save
- Something is filtering my shortcodes… Can’t figure out what
- Use has_filter on comment_post
- Filter Post Title without affecting screen-reader-text
- How can I see exactly what arguments are being passed through a filter so that I may modify them?
- How do I add a class to all sidebars to let a Google Custom Search Engine know not to index the content?
- Redirecting the user to the admin table area after publishing a post, getting an invalid response error?
- Filter a custom post type by custom field in admin