I managed to solve this by doing this: –
- Create a select control in the edit function.
{
<SelectControl
label="Size"
value={ size }
options={ [
{ label: 'Display 1', value: 'display-1' },
{ label: 'Display 2', value: 'display-2' },
{ label: 'Display 3', value: 'display-3' },
{ label: 'Display 4', value: 'display-4' },
] }
onChange={ ( size ) => props.setAttributes( { size: size } ) }
/>
}
- Create an attribute (size)
- Change the select control to change the size attribute
- Pass the props to the save function props.attributes.size
Related Posts:
- Passing RichText attributes to function onChange
- How do I store information in a dynamic block in WordPress?
- How to add Internationalization in WordPress using Javascript/React?
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- Fixed: Console.log twice in the edit function
- Vanilla javascript in custom gutenberg block not working
- Getting a custom Gutenberg component’s state from outside that component
- How do I only load a plugin js on it’s settings pages?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Dequeue / Deregister script and replace it with a new plugin
- Insert code after tag without using functions.php?
- How do I use WordPress PHP functions in my Javascript code?
- Difference between register_block_type & wp.blocks.registerBlockType
- How to create popup same as wordpress popup feature
- Has anyone used require.js for handling plugin scripts?
- Can I share predefined fonts from theme_support with a gutenberg component?
- Gutenberg List Extension Block
- How to create custom embed block in gutenberg wordpress
- How to load plugin after page is loaded – pagespeed issues
- How to use get_theme_mod in gutenberg editor wordpress?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- React JSX in WordPress Plugin Development
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Best approach to fetch data from wp options to js file or php file
- Updating the Drag-To-Share eXtended share URLs?
- Enqueue WordPress plugin scripts below all other JS
- how to disable blockrenderAppender inside all Innerblocks?
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- Using SVN to upload plugin created with gutenberg blocks
- wp.media javascript issue with on select
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Redirect to another page using contact form 7? [closed]
- Delay JavaScript files from loading
- How to add custom table style for table block in gutenberg editor
- Gutenberg Block Style CSS Class Is Not Applying on Backend
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- How to use custom Javascript code inside a plugin?
- how to request a script more than once in wordpress
- Use a custom block in another block
- Gutenberg default attributes are empty when accessing in edit
- Gutenberg: Prevent links from being clickable in the block. Error: “Cannot destructure property ‘frameElement’ of ‘r’ as it is null.”
- Has blocks gutenberg block multiples registers type in my Plugin
- Cannot run script properly with my custom plugin
- Possible way of having multiple Gutenberg instances for a page?
- How to resolve warning for `unstableOnSplit` prop on a DOM element in block editor
- How to dynamically add template in Innerblock?
- Add style to body based on url
- How to properly enqueue jQuery knob on WordPress without conflict?
- How to create a custom block in Gutenberg with multiple checkboxes?
- Problem with wordpress has_action() function
- Multiple image selection custom widget
- Create a form and have custom menu display based on user answers?
- AJAX update fails for public/non-admin users
- Block content rendering on the top just below body tag
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- How to use information from the database in the front-end?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to pass value from WordPress to Javascript
- Javascript in plugin not working
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Creating a user ‘add custom field’ section
- Need to hide an element depending on date and post category
- Ajax, jQuery and WordPress
- Plugin – including external javascript calling google maps
- get_option include in my adsense
- Is it possible to run javascript on plugin deactivated?
- Ajax in Plugins: returns the whole page
- Gutenberg: Dynamic Block – Show saved data in the editor
- Load css classes after using ajax calls
- How to create post comparison in wordpress
- Create plugin with multiple blocks
- How to access values from your own settings page in javascript?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- How do I set register_meta for a specific CPT?
- How do I save meta key value in the save function?
- Update Content for a Custom Block Toolbar Button
- Wrong block appender button showing
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?
- WordPress custom block: Link saved in database not retrieved when editing post
- Implementing onSplit/onMerge in dynamic Gutenberg Custom Blocks
- Why is my Gutenberg block not saving and rendering the chessboard?
- How can we extent core/group or cover block?
- Editing a block to add a button to have a drop cap
- Zip using “wp-scripts plugin-zip” with custom “build” folder and subfolders?
- How to list latest 5 posts from each author from a custom CPT? I want to create a custom Gutenberg block
- TinyMCE – Unable to load the editor in vue front-end plugin page
- Custom block padding control (via support) initialization
- WordPress custom block: How to treat each button as a separate block?
- Custom block based off core block using filter
- WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
- How to change the version of block.js and plugin to the same of Package.json?
- can not serialize and insert data from custom form
- How do I apply different block supports to different parts of my custom block?
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- Best way to initiate a class in a WP plugin?