Skip to content

Instantly share code, notes, and snippets.

@belcherj
Created August 14, 2018 18:50
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 belcherj/b458cba2a26f6a98e75687b187bb42bd to your computer and use it in GitHub Desktop.
Save belcherj/b458cba2a26f6a98e75687b187bb42bd to your computer and use it in GitHub Desktop.
Broken 3 column layout
/**
* Internal dependencies
*/
import './style.scss';
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { InnerBlocks } from '@wordpress/editor';
const TEMPLATE = [
[ 'core/heading', {
className: 'wp-block-wccom-three-column-header',
placeholder: __( 'Enter Title...', 'wccom' ),
} ],
[ 'core/columns', { className: 'wp-block-wccom-three-column-content' }, [
[ 'core/column', {}, [
[ 'core/heading', { placeholder: __( 'Enter Title...', 'wccom' ) } ],
[ 'core/paragraph', { placeholder: __( 'Enter Description...', 'wccom' ) } ],
] ],
[ 'core/column', {}, [
[ 'core/heading', { placeholder: __( 'Enter Title...', 'wccom' ) } ],
[ 'core/paragraph', { placeholder: __( 'Enter Description...', 'wccom' ) } ],
] ],
[ 'core/column', {}, [
[ 'core/heading', { placeholder: __( 'Enter Title...', 'wccom' ) } ],
[ 'core/paragraph', { placeholder: __( 'Enter Description...', 'wccom' ) } ],
] ],
] ],
];
registerBlockType( 'wccom/three-column-content', {
title: __( 'Three Column Content', 'wccom' ),
icon: 'cart',
category: 'wccom',
keywords: [
__( 'woo', 'wccom' ),
__( 'header', 'wccom' ),
__( 'columns', 'wccom' ),
],
edit() {
return (
<InnerBlocks template={ TEMPLATE } />
);
},
save() {
return (
<InnerBlocks.Content />
);
},
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment