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 | |
// Filters the front-end output of the query block | |
function prefix_random_posts_block_variation( $pre_render, $block ) { | |
// Verify it's the block that should be modified using the namespace | |
if ( !empty($block['attrs']['namespace']) && 'namespace/random-ordered-posts' === $block[ 'attrs' ][ 'namespace' ] ) { | |
add_filter( 'query_loop_block_query_vars', function( $query ) { | |
$post = get_queried_object(); |