Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike McAlister mikemcalister

View GitHub Profile
View favorite.js
/**
* Favorite button
*/
const { __ } = wp.i18n;
const { apiFetch } = wp;
const {
Component,
Fragment
} = wp.element;
View favorite.js
/**
* Favorite button
*/
const { __ } = wp.i18n;
const { apiFetch } = wp;
const {
Component,
Fragment
} = wp.element;
View favorite.js
/**
* Favorite button
*/
const { __ } = wp.i18n;
const { apiFetch } = wp;
const {
Component,
Fragment
} = wp.element;
View index.js
wp.hooks.addFilter(
"blocks.getBlockDefaultClassName",
"atomicblocks/ab-column-block-class-name",
abCustomClassName
);
function abCustomClassName( className, name ) {
if ( 'atomic-blocks/ab-columns' === name ) {
return classnames(
className,
View template.js
<InnerBlocks template={[
['core/heading', { content: 'Test Content', level: '3', }], ]}
templateLock={ false }
/>
View template.js
<InnerBlocks
template={[
// Add placeholder blocks
['atomic-blocks/ab-pricing-table-title', {
title: 'Price Title',
fontSize: 'medium',
}],
['atomic-blocks/ab-pricing-table-subtitle', {
subtitle: 'Price Subtitle Description',
fontSize: 'normal',
View block.js
/**
* BLOCK: Atomic Blocks Test Block
*/
// Import block dependencies and components
import Inspector from './components/inspector';
import omit from 'lodash/omit';
// Extend component
const { Component } = wp.element;
View style.js
style={ {
backgroundColor: containerBackgroundColor,
textAlign: containerAlignment,
paddingLeft: containerPaddingLeft ? `${containerPaddingLeft}%` : null,
paddingRight: containerPaddingRight ? `${containerPaddingRight}%` : null,
paddingBottom: containerPaddingBottom ? `${containerPaddingBottom}%` : null,
paddingTop: containerPaddingTop ? `${containerPaddingTop}%` : null,
marginTop: containerMarginTop ? `${containerMarginTop}%` : null,
marginBottom: containerMarginBottom ? `${containerMarginBottom}%` : null,
} }
View styles.js
<div
style={ {
textAlign: containerAlignment,
paddingLeft: `${containerPaddingLeft}%`,
paddingRight: `${containerPaddingRight}%`,
paddingBottom: `${containerPaddingBottom}%`,
paddingTop: `${containerPaddingTop}%`,
marginTop: `${containerMarginTop}%`,
marginBottom: `${containerMarginBottom}%`,
} }>
View inspector.js
/**
* Inspector Controls
*/
// Setup the block
const { __ } = wp.i18n;
const { Component } = wp.element;
// Import block components
const {