/grid/settings

DescriptionDescription

This filter is called every time grid settings are queried before to render or refresh grid (when filering with facets).

It allows to dynamically modifies settings of a grid. It can be pretty useful to use the same grid on different pages/posts with different behaviours.

ArgumentsArguments

ArgumentTypeDescription
$settings arrayHolds grid settings

ExampleExample

PHP
functions.php
function prefix_grid_settings( $settings ) {

	// If it matches grid id 1, we change the grid type.
	if ( 1 === $settings['id'] ) {
		$settings['type'] = 'masonry';
	}

	return $settings;

}

add_filter( 'wp_grid_builder/grid/settings', 'prefix_grid_settings', 10, 1 );