/card/tag

DescriptionDescription

This filter is called when a card is lay out.

It allows to modifies tag name of card holders in grids. By default the tag name is article. Because, depending of the markup of your page, you may need to change this tag to be 100% W3C compliant.

ArgumentsArguments

ArgumentTypeDescription
$tagstringTag name used for the card holder
$cardarrayHolds card layers and blocks definitions
$settingsobjectHolds grid settings

ExampleExample

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

	// If the current grid has gallery post type.
	if ( in_array( 'gallery', (array) $settings->post_type, true ) ) {
		$tag = 'div';
	}

	return $tag;

}

add_filter( 'wp_grid_builder/card/tag', 'prefix_card_tag', 10, 3 );