Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidallenlewis/72ed44b8e3b50410bd1388ce018ffe7d to your computer and use it in GitHub Desktop.
Save davidallenlewis/72ed44b8e3b50410bd1388ce018ffe7d to your computer and use it in GitHub Desktop.
<?php
/**
* Register webinar date type variation
*
* @param array $variations Array of block type variation
* @param WP_Block $block_type The block type.
* @return array
*/
function webinar_date_block_variation( $variations, $block_type ) {
if ( 'core/paragraph' === $block_type->name ) {
$variations[] = array(
'name' => 'webinar-date',
'title' => 'Webinar Date',
'attributes' => array(
'metadata' => array(
'bindings' => array(
'content' => array(
'source' => 'acf/field',
'args' => array(
'key' => 'webinar_date',
),
),
),
),
),
);
}
return $variations;
}
add_filter( 'get_block_type_variations', 'webinar_date_block_variation', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment