How do I load css in edit screens for the block builder?

To load a custom stylesheet for the WordPress admin screens that manage posts and use the block editor, you can use the admin_enqueue_scripts hook to enqueue your stylesheet. Here’s an example of how you can achieve this: First, create a custom stylesheet (let’s call it admin-custom-styles.css) and place it in your theme or plugin directory. … Read more

Add custom data attribute to every core Gutenberg Blocks

I found the solution: I removed addFilter(‘blocks.getSaveContent.extraProps’, ‘luxuryconcept/add-custom-props’, addCustomProps); as @TomJNowell recomended. I added the add_filter(‘render_block’, ‘theme_custom_add_custom_attributes’, 10, 2); PHP code to functions.php: So, here all the working code: JS: /** * * Extends Core Gutenberg Blocks functionalities * * @description Add data-delay and data-duration attributes to every Gutenberg Core Blocks * @package luxuryconcept * … Read more

No aspect ratio selector in a custom block

Per the developer handbook: This value signals that a block supports some of the CSS style properties related to dimensions. When it does, the block editor will show UI controls for the user to set their values if the theme declares support. So in your theme you’ll need to declare support either by setting appearanceTools … Read more

Problems with the PluginDocumentSettingPanel SlotFill in Gutenberg

It doesn’t work because that is old behaviour and Gutenberg changed a year ago. Where The Confusion Comes From This commit: https://github.com/WordPress/gutenberg/commit/00cb38c3655daffd429ad4acfc57d6ee3b7f2d83 On Apr 20, 2022 code was removed that made it fallback to the plugin icon. Now an icon has to be explicitly passed as a prop or no icon is shown. Why? https://github.com/WordPress/gutenberg/pull/40355 … Read more