/layout/wrapper_tag

DescriptionDescription

This filter is called before the opening and closing HTML tag of the main wrapper (which may holds facets and grid items). It is used for grids or templates (seewpgb_render_template())

It allows to modifies tag name of the main layout wrapper which can holds facets and grid items. By default the tag name is div. Depending of your needs and page structure you may need, for example, to change it to a section.

ArgumentsArguments

ArgumentTypeDescription
$tag string Tag name used for the layout wrapper (div by default)
$settingsobjectHolds grid settings

ExampleExample

PHP
functions.php
function prefix_layout_tagname( $tag, $settings ) {

	// If it matches grid id 1 (or a template name for example).
	if ( 1 === $settings->id ) {
		$tag = 'section';
	}

	return $tag ;

}
add_filter( 'wp_grid_builder/layout/wrapper_tag', 'prefix_layout_tagname', 10, 2 );