This file contains 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
<?php | |
function randomize_block_core_gallery( $parsed_block ) { | |
if ( 'core/gallery' === $parsed_block['blockName'] && isset( $parsed_block['attrs']['className'] ) && 'random' === $parsed_block['attrs']['className'] ) { | |
shuffle( $parsed_block['innerBlocks'] ); | |
} | |
return $parsed_block; | |
} | |
add_filter( 'render_block_data', 'randomize_block_core_gallery' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment