Skip to content

Instantly share code, notes, and snippets.

@phpbits
Last active July 28, 2019 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpbits/ed9f7372ac5a8a2408fd10c9d10ebe9a to your computer and use it in GitHub Desktop.
Save phpbits/ed9f7372ac5a8a2408fd10c9d10ebe9a to your computer and use it in GitHub Desktop.
Create custom image block style variations.
wp.domReady( () => {
wp.blocks.registerBlockStyle( 'core/image', {
name: 'default',
label: __( 'Default' ),
isDefault: true,
} );
wp.blocks.registerBlockStyle( 'core/image', {
name: 'circular-image',
label: __( 'Circular' ),
isDefault: false,
} );
wp.blocks.registerBlockStyle( 'core/image', {
name: 'rounded-corners',
label: __( 'Rounded Corners' ),
isDefault: false,
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment