Skip to content

Instantly share code, notes, and snippets.

@elpuas
Created December 29, 2022 14:43
Show Gist options
  • Save elpuas/ddc57876d706927dc3c9133606ab5598 to your computer and use it in GitHub Desktop.
Save elpuas/ddc57876d706927dc3c9133606ab5598 to your computer and use it in GitHub Desktop.
Flip Cards Variations
const FLIP_CARDS = 'loop-patterns/flip-cards';
wp.domReady( function() {
wp.blocks.registerBlockVariation( 'core/query', {
name: FLIP_CARDS,
title: 'Flip Cards',
description: 'Flip Cards Query',
isActive: ( { namespace, query } ) => {
return (
namespace === FLIP_CARDS
&& query.postType === 'post'
);
},
icon: 'format-gallery',
attributes: {
namespace: FLIP_CARDS,
className: 'lp-flip-cards',
tagName:'section',
query: {
perPage: 3,
pages: 0,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: false,
},
},
scope: [ 'inserter' ],
innerBlocks: [],
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment