Skip to content

Instantly share code, notes, and snippets.

View jorgefilipecosta's full-sized avatar

Jorge Costa jorgefilipecosta

View GitHub Profile
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
const { __ } = wp.i18n;
const divProps = { className: 'product', style: { outline: '1px solid gray', padding: 5 } };
const template = [
[ 'core/image' ],
[ 'core/video' ],
[ 'core/cover' ],
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
registerBlockType( 'acme/product', {
title: 'Product',
icon: 'carrot',
category: 'common',
function gutenberg_test_cpt_locking() {
$template = array(
array( 'core/image' ),
array(
'core/paragraph',
array(
'placeholder' => 'Add a description',
),
),
array( 'core/quote' ),
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
registerBlockType( 'test/my-test', {
title: 'Test',
icon: 'carrot',
category: 'common',
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
registerBlockType( 'test/parent', {
title: 'Test Parent',
icon: 'cart',
category: 'common',
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
const circle = el( 'circle', { cx: 10, cy: 10, r: 10, fill: 'red', stroke: 'blue', strokeWidth: '10' } );
const svg = el( 'svg', { width: 20, height: 20, viewBox: '0 0 20 20'}, circle );
registerBlockType( 'test/parent', {
title: 'Test Parent',
icon: {
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
var TextControl = wp.components.TextControl;
var RangeControl = wp.components.RangeControl;
registerBlockType( 'test/parent', {
title: 'Test Parent',
icon: 'cart',
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
registerBlockType( 'test/parent', {
title: 'Test Parent',
icon: 'cart',
category: 'common',
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
registerBlockType( 'test/raw-handler', {
title: 'Test Raw Handler',
icon: 'cart',
category: 'common',
attributes: {
text: {
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
registerBlockType( 'acme/product', {
title: 'Product',
icon: 'carrot',
category: 'common',