Skip to content

Instantly share code, notes, and snippets.

@Tepluypled
Created November 27, 2019 09:28
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 Tepluypled/2c2baf04a23723352174458c9fe347f3 to your computer and use it in GitHub Desktop.
Save Tepluypled/2c2baf04a23723352174458c9fe347f3 to your computer and use it in GitHub Desktop.
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
Copy link

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