Created
July 24, 2019 08:32
-
-
Save knuch/ffdc55c41c33d0a22430099af03d6f10 to your computer and use it in GitHub Desktop.
Revisions
-
knuch revised this gist
Jul 24, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php // https://developer.wordpress.org/reference/hooks/render_block/ add_filter( 'render_block', 'foo_core_gallery_filter', 10, 3); -
knuch created this gist
Jul 24, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ // https://developer.wordpress.org/reference/hooks/render_block/ add_filter( 'render_block', 'foo_core_gallery_filter', 10, 3); function foo_core_gallery_filter( $block_content, $block ) { // use blockName to only affect the desired block if( "core/calendar" !== $block['blockName'] ) { return $block_content; } // $block_content contains all the data passed to the block callback function // $block contains the serialized block markup // Here you have all content over the block. Either wrap it in your container or totally replace the content $output = '<h2 class="foo-gallery">'; $output .= 'GALLERY'; $output .= '</h2>'; // return the new content of the block return $output; }