Created
June 23, 2017 18:11
-
-
Save mtias/ecaf95f1c0ab880b18015a1eb3eb7160 to your computer and use it in GitHub Desktop.
Creating a Gutenberg block from the console.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el = wp.element.createElement; | |
wp.blocks.registerBlockType( 'mytheme/block', { | |
title: 'Red Block', | |
icon: 'universal-access-alt', | |
category: 'layout', | |
edit: function() { | |
return el( 'div', { style: { backgroundColor: '#900', color: '#fff', padding: '20px' } }, 'I am a red block.' ); | |
}, | |
save: function() { | |
return el( 'div', { style: { backgroundColor: '#900', color: '#fff', padding: '20px' } }, 'I am a red block.' ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment