Created
December 8, 2017 00:54
-
-
Save zgordon/706774c8d41857fa65e9f4a3faa1942d to your computer and use it in GitHub Desktop.
Use the "keywords" settings parameter to add additional search keywords for your block.
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
// Import __ from i18n internationalization library | |
const { __ } = wp.i18n; | |
// Import registerBlockType() from block building libary | |
const { registerBlockType } = wp.blocks; | |
// Import the element creator function (React abstraction layer) | |
const el = wp.element.createElement; | |
/** | |
* Register Block. | |
* | |
* @param {String} name Block name, namespaced | |
* @param {Object} settings Block settings | |
* @return {?WPBlock} Return the block or 'undefined' | |
*/ | |
registerBlockType('js4wpgb/static-content', { | |
title: __('Custom Block'), | |
icon: el('svg', { width: 20, height: 20 }, | |
el('path', { d: "M7.5,0.5L5,4.5l-1.5-2 C2.9452,3.4753,0.8036,5.7924,0.8036,8.3036C0.8036,12.002,3.8017,15,7.5,15s6.6964-2.998,6.6964-6.6964 c0-2.5112-2.1416-4.8283-2.6964-5.8036l-1.5,2L7.5,0.5z M7.5,7c0,0,2.5,2.5618,2.5,4.5c0,0.8371-0.8259,2-2.5,2S5,12.3371,5,11.5 C5,9.6283,7.5,7,7.5,7z" } ) | |
), | |
// Additional search terms for your block | |
keywords: [ __( 'zac' ), __( 'fire' ), __( 'fuego' ) ], | |
category: 'common', | |
edit( props ) { | |
return el('p', {}, 'Hello world!'); | |
}, | |
save( props ) { | |
return el('p', {}, 'Hello world!'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment