Object type for block Attribute (Gutenberg)

Yes, there is. It will be like this: spacing: { type: ‘object’, default: { margin: { global: { …DIRECTIONS }, tablet: { …DIRECTIONS }, desktop: { …DIRECTIONS }, unit: ‘px’, size: 0, sync: false, syncTablet: false, syncDesktop: false }, padding: { global: { …DIRECTIONS }, tablet: { …DIRECTIONS }, desktop: { …DIRECTIONS }, unit: ‘px’, … Read more

React to a change of the block alignment

Turns out that if one uses wp.data.subscribe, you’re able to intercept any change that occurr in the editor. As you can imagine, this is not very performant. So I’ve decided to create an extra hidden attribute that stores the old alignment value for the block, and fire the callback only when that attribute and the … Read more

How to enable Block Editor on the Posts page

There are two options: Easy (or without coding) In short, make sure the page has a non-empty content. Set the “Posts page” to none. Edit the page you wanted to be the posts page and enter any content — even a space () would be sufficient. Save the page. Now set the “Posts page” to … Read more

Unable to override MediaPlaceholder component

wp.blockEditor.MediaPlaceholder is not the class, it’s the following code in the Gutenberg/Block Editor’s media-placeholder file: export default compose( applyWithSelect, withFilters( ‘editor.MediaPlaceholder’ ), )( MediaPlaceholder ); Thus an infinite loop as the filter is applied constantly.

Can Gutenberg be used as an editor on a page?

As Tammy states here: There is a plugin you may want to dig a little into https://github.com/tomjn/Frontenberg, this is purely a demonstration of putting Gutenberg on the front, not something that is planned yet. It may hold some insights though for you. Right now there is no option/shortcode to do this. That was written a … Read more

How to learn Gutenberg block development [closed]

The Block Editor Handbook offers the official documentation, along with some examples, including a Blocks Tutorial. It’s improving over time to include more and more information and examples. The JS for WP site offers some tutorials. The caveat is the Gutenberg Block Development course and the Advanced Gutenberg course were both created in the early … Read more

Insert SVG code (not img) in HTML block

I tried this code on a clean install of WordPress <svg width=”100″ height=”100″> <circle cx=”50″ cy=”50″ r=”40″ stroke=”green” stroke-width=”4″ fill=”yellow” /> </svg> and used ‘Custom HTML’ in Guttenberg in a new post. This worked fine for me. The same code displayed in the DOM without deleting any tags or adding any Maybe you cant edit … Read more

Delete a Gutenberg Block Programmatically?

For the original approach – when you delete a forum post, search the database and remove any blocks that refer to that specific post – it looks like the only way to accomplish this would be with a regular expression, which could break in future updates. You could hook into the delete_post hook, verify that … Read more

Align Group blocks left or right

OK, I found a way to do this after browsing the source code. I do note that the code that helped me lives under deprecated.js so it’s possible this won’t continue to work. Here’s the JS code I have in my plugin directory function addAlignmentToGroups(settings, name) { if (name !== “core/group”) { return settings; } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)