Hello @thbunte,
Unfortunately, as of now, there is no such option to set offset in the Post Grid and the Post Masonry blocks.
However, this can be achieved using the filter code.
For the Post Grid block:
To apply different filters for different Post Grid Blocks you need to add unique classes to each of the blocks from the Advanced Tab of Post Grid Block.
Please refer to this screenshot.
After that, you can just add “if” condition for each of the Blocks.
For example: If you want to add different Offsets to different blocks you can use the following code for the Post Grid block:
function filter_post_query( $query_args, $attributes) {
// Unique class name added from Advanced tab for Post Grid Block.
if ( 'my-post-grid-class' == $attributes['className'] ) {
$query_args['offset'] = 3;
}
// Unique class name added from Advanced tab for Post Grid Block.
if ( 'second-my-post-grid-class' == $attributes['className'] ) {
$query_args['offset'] = 4;
}
//And So on....
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
For the Post Masonry block:
Similarly, just like the above step, you have to first add unique classes to each of the blocks from the Advanced Tab of Post Masonry Block.
After that again, you can just add “if” condition for each of the Blocks.
For example: If you want to add different Offsets to different blocks you can use the following code for Post Masonry block:
function filter_post_query( $query_args, $attributes) {
// Unique class name added from Advanced tab for Post Masonry Block.
if ( 'my-post-masonry-class' == $attributes['className'] ) {
$query_args['offset'] = 3;
}
// Unique class name added from Advanced tab for Post Grid Block.
if ( 'second-my-post-masonry-class' == $attributes['className'] ) {
$query_args['offset'] = 4;
}
//And So on....
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
I hope this helps.
Regards,
Sweta