Best approach to change mobile background image and adding its class

As I am extending core/group block to add option for setting different image for smaller displays I used render_block_core/group filter to add style tag. I am already adding data-mobile-background-image to each group for its mobile view background image so there is no need for updating it through ID as suggested by Tom J Nowell. Final … Read more

Consistent inline styling in a Gutenberg-paragraph-block

To add custom options to that dropdown, you’d want to look at utilizing the Formatting API. Below are the main points quoted from the Block Editor Handbook step-by-step guide: Step 1: Register a new format The first step is to register the new format, add src/index.js with the following: import { registerFormatType } from ‘@wordpress/rich-text’; … Read more

Custom Gutenberg block within column block selection and update issue

You seem to have useBlockProps() and extra props outside of this hook: <div { …useBlockProps() } className=”card” style={{ backgroundImage: `url(${imageUrl})`}} > Your className would override any className value provided by the useBlockProps(), potentially causing the undesired behavior. Instead, consider merging the props into the props that would be emitted by useBlockProps() by passing them into … Read more

Translations not making it into Block UI but work in the rest of the plugin

It seems like you do not have any JavaScript localization files to use with wp_set_script_translations(). If we consult the Gutenberg/JavaScript documentation for internationalization: The translation files must be in the JED 1.x JSON format. […] <?php function myguten_set_script_translations() { wp_set_script_translations( ‘myguten-script’, ‘myguten’, plugin_dir_path( __FILE__ ) . ‘languages’ ); } add_action( ‘init’, ‘myguten_set_script_translations’ ); WordPress will … Read more