Override image maximum width in theme (Using Gutenberg editor)

add_theme_support(‘gutenberg’, [‘wide-images’ => true ]) is telling gutenberg, hey this sites content area’s CSS is setup to handle wide images. The theme_support wide-images code isn’t a magic fix – instead it’s an aknowledgment from the theme developer to gutenberg, that the themes CSS’s ready for gutenberg wide content. — If you’re just experimenting, and only … Read more

Gutenberg Editor – Template Doesn’t Match Error

This is a known issue. A hack would be to disable to the validation completely for the block. Chris Van Patten provided the following code example: /** * WordPress dependencies */ import { compose } from ‘@wordpress/compose’; import { withDispatch } from ‘@wordpress/data’; import { InnerBlocks } from ‘@wordpress/editor’; /** * Container block * * … Read more

Gutenberg moving core blocks between categories

Although I’m unsure on how to achieve this in php, within javascript you can change the category by hooking into the blocks.registerBlockType hook. Here is a small example how it would work, although I’d recommend using lodash to deepClone the settings object to keep everything immutable. const rearrangeBlockCategories = { ‘core/table’: ‘common’, }; wp.hooks.addFilter(‘blocks.registerBlockType’, ‘[namespace]’, … Read more

Access GutenBerg data with Javascript?

All datas seems to be stored in JS objects, and not in HTML-DOM. We can use: wp.data.select(“core”).getXXXXXXXXXXXX() wp.data.select(“core/editor”).getXXXXXXXXXXXX() … There are many areas too, you can list them with: console.log(wp.blocks.getBlockTypes());

Apply image width to tag

I am assuming you want this value on the front-end as opposed to needing it in the block editor due to the <figure> somehow not displaying correctly when viewed in the block editor. If that is the case then you can use something similar to DOMDocument as per the following example: Assume HTML of: <div> … Read more

Gutenberg internal page link search box

I found a solution and thought to post it here as others might need it el(URLInput, { className: props.className, value: attributes.linkURL, placeholder: i18n.__(‘Set the specific url’), onChange: function( url ) { props.setAttributes({ linkURL: url }); } }) Does exactly what I need.