Created
February 23, 2023 15:37
-
-
Save janboddez/25acb04f449171a4beae6b55a3e6e9a3 to your computer and use it in GitHub Desktop.
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