Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
( function( blocks, components, i18n, element ) {
var el = element.createElement;
blocks.registerBlockType(
// The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block.
'nelio/testimonial-block', {
// The title of our block.
title: i18n.__( 'Testimonial' ),
// Dashicon icon for our block.
icon: 'megaphone',
// The category of the block.
category: 'common',
// Necessary for saving block content.
attributes: {
name: {
type: 'array',
source: 'children',
selector: 'p.nelio-testimonial-name',
},
position: {
type: 'array',
source: 'children',
selector: 'p.nelio-testimonial-position',
},
testimonial: {
type: 'array',
source: 'children',
selector: 'p',
},
mediaID: {
type: 'number',
},
mediaURL: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
},
alignment: {
type: 'string',
default: 'center',
}
},
edit: function( props ) {
...
},
save: function( props ) {
...
}
} );
} )(
window.wp.blocks,
window.wp.components,
window.wp.i18n,
window.wp.element,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.