Replication of core column block produces different markup
Setting apiVersion: 2 while registering the block resolved this issue.
Setting apiVersion: 2 while registering the block resolved this issue.
I’m not sure about the second one (removing the wrappers), but as for limiting the allowed blocks: First I want to make it so that the ONLY block that can be added as a child block of the feature-cards is the child block. How can I enforce this? You can use the allowedBlocks property of … Read more
Excerpt from “Creating dynamic blocks” in the block editor handbook: The server-side rendering is a function taking the block and the block inner content as arguments, and returning the markup (quite similar to shortcodes) So despite the “render” as in render_callback, a block render callback should not actually echo anything (and neither call any functions … Read more
Sounds like what I had to deal with recently, having forgotten I had this option checked: on the user profile page. Uncheck it if needed, otherwise it will display the post/page as: with e.g. the add blocks button (+) disabled.
The 3rd parameter for the function accepts a private option named __unstableHTML which if true, then enables HTML in the notice message/content: createNotice( ‘success’, ‘Post published.<br /> Line 2. Should work in WordPress 5.8.’, { __unstableHTML: true, // true = allows HTML; default false isDismissible: true, actions: [ … ], } ) However, in the … Read more
This should theoretically work by defining the initial value in theme.json as shown in these examples https://gist.github.com/skorasaurus/d50ea7eb79d664775418492e46cef021 and https://github.com/WordPress/theme-experiments/blob/304e6ef3d561f048c87d9bc27311328ae8197bae/tt1-blocks/theme.json#L276 however, the value is still unset when I tried it out in a theme and it appears they may have disabled it – https://github.com/WordPress/gutenberg/issues/29210
Using the render_block filter (as opposed to wrapping the block with your custom block) is a simpler way to accomplish what you want. The filter runs for all blocks so you have to conditionally apply your logic to just the blocks you want. The attributes of each block will be available ($block[attrs]) and for the … Read more
This correctly shows true/false when the option for Reduce the interface is enabled/disabled through the GUI. Are you sure isFeatureActive( ‘reduceInterface’ ) worked? Because I looked at the source code (see wp-includes/js/dist/edit-post.js) and then I found out that the feature name is actually reducedUI and not reduceInterface. So try with reducedUI instead: let reduceInterface = … Read more
In order to accomplish this, I created a custom data store and extracted the available meta keys from the routes object returned when hitting the wp-json/wp/v2/ endpoint in the editor. This approach decreased the number of API requests compared to that with which I started. The initial approach in the question would have made one … Read more
The solution is simple: has_block( ‘simpetoc/toc, $YOUR_POSTS_CONTENT_OR_POST_ID ) https://developer.wordpress.org/reference/functions/has_block/ has_block( string $block_name, int|string|WP_Post|null $post = null ) There is no need to render the blocks to build a table of contents, nor should you do it that way. Note that your current approach breaks user defined HTML anchors and doesn’t account for headings in nested … Read more