Skip to content

Instantly share code, notes, and snippets.

@Tepluypled

Tepluypled/custom.js

Created Nov 27, 2019
Embed
What would you like to do?
Part1
registerBlockType('namespace/block-slug', {
//built-in attributes
title: 'The name',
description: 'Block to generate a custom event',
icon: 'format-image',
category: 'layout'
//custom attributes
attributes: {
content: {type: 'string'}
},
//custom functions
//built-in functions
edit: function(props) {
function somename(event) {
props.setAttributes({content: event.target.value})
}
return wp.element.createElement(
"div",
null,
wp.element.createElement(
"h3",
null,
"Enter your sample text"
),
wp.element.createElement("input", { type: "text",
value: props.attributes.content, onChange: somename })
);
},
save() {}
});
@zonayedpca

This comment has been minimized.

Copy link

@zonayedpca zonayedpca commented Feb 4, 2020

you forget to put a comma after this line

category: 'layout'
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.