This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import edit from './edit'; | |
import { registerBlockType } from '@wordpress/blocks'; | |
import {__} from '@wordpress/i18n'; | |
registerBlockType("mytheme-blocks/firstblock", { | |
title: __("First Block", "mytheme-blocks"), | |
description: __("Our first block", "mytheme-blocks"), | |
category: "layout", | |
icon: "admin-network", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"settings": { | |
"color": { | |
"custom": false, | |
"customGradient": false, | |
"link": false, | |
"gradients": [], | |
"duotone": [], | |
"palette": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'block_type_metadata_settings', 'filter_metadata_registration', 10, 2 ); | |
public function filter_metadata_registration( $settings, $metadata ) { | |
if ( 'core/cover' == $metadata['name'] ) { | |
if ( is_array( $settings['supports']['color'] ) ) { | |
$settings['supports']['color']['background'] = true; | |
} else { | |
$settings['supports']['color'] = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
const FileLoader = { | |
test: /\.(png|jpe?g|gif)$/i, | |
type: 'asset/resource', | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Transform from an ACF block with repeating rows, to a custom block with child blocks | |
the content field on the ACF Block is a WYSIWIG Editor so we translate it to RAW HTML and pass it as inner blocks to the new accordion panel **/ | |
wp.hooks.addFilter( | |
'blocks.registerBlockType', | |
'local27/accordion-transform', | |
function( settings, name ) { | |
if ( name === 'acf/accordion' ) { | |
settings.transforms = { | |
to: [ |
OlderNewer