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
- How to add a shortcode button to the TinyMCE editor?
- Modifying a JS file with data from plugin settings
- Understanding apply_filters
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- uninstall.php file in Plugin to clean DB
- Save / Show multi line text in metabox
- add_filter doesn’t work
- Run function on plugin activation before plugin is loaded
- WordPress Feed Creator Name Tag Full Name Instead Of First Name
- How to add custom function to pluggable.php
- Access remote SFTP server via WordPress login?
- Customizer preview URL not updating when settings reset to default
- Echo custom admin field into a is_single()
- Exclude specifed files from plugin editor
- How to create a dashboard for logged-in users with custom functionality? [closed]
- How to provide page_template path in custom plugin using WordPress