Why is onChange={ ( content ) => setAttributes( { content } )} now used?
Looking through older tutorials or code for blocks built in 2018/2019 vs the more current blocks, I see two different ways attribute values are set.
Looking through older tutorials or code for blocks built in 2018/2019 vs the more current blocks, I see two different ways attribute values are set.
I’ve got a WP Block with a <ServerSideRender /> component in the backend. It works fine with the attributes. But it does not return the $content used in the php callback for the frontend.
Is it possible to convert an existing WordPress widget to a block, without having to write a custom block (javascript)?
I could not get to work. When published the content the attribute innerContent didn’t save. Here is what I tried.
I have a SelectControl in a custom block, to set a meta field. It works, but would be better if it were a ComboboxControl, as the list of options is likely to grow, but I get errors when I switch it over to a Combobox – leaving all other settings the same. This is currently running on localhost, using WAMP.
For the columns block type, I’d like to add in a default value of wp-block-columns--padded in the “Additional CSS class(es)” field, the idea being that the user could remove or modify the class as needed (i.e. removing it to disable all padding, changing it wp-block-columns--padded-extra for additional padding, etc.). Is it possible to do this via a filter or something similar? I did look in to wp.hooks.addFilter, but that didn’t allow the user to edit the classes that I added.
I am trying to use UnitControl in my custom Gutenberg block to define the line-height of text. I receive the “This block has encountered an error and cannot be previewed” when I try to access the block in the WordPress editor. I am unsure what is causing this error. I’ve even tried removing references to the UnitControl in the return and save such as lineHeight:headlineSpacing to see if it would stop flagging the error. It still gives me the error so I am unsure if I am using UnitControl correctly at all or if perhaps I’ve made a mistake in the <UnitControl> element.
Let’s have a block that creates a Carousel using <InnerBlocks />:
I’m really struggling trying to get any information at all on how to do this. the project is part of a church website holding a collection of ‘talks’ (custom post type) which has data attached such as AudioURL, VideoURL, Speaker, Series etc. Speaker and Series are custom taxonomies rather than free text.
I’m trying to re-categorise some existing blocks (both core and third party). I’ve been told this should be doable using the registerBlockType filter but I haven’t had much luck.