DescriptionDescription
This filter is called before a card is lay out.
It allows to modify card attributes like the number of columns
or rows
, content_background
, overlay_background
, content_color_scheme
, overlay_color_scheme
or class
.
ArgumentsArguments
Argument | Type | Description |
$atts | array | Holds card attributes |
$card | object | Holds card layout (layers/blocks) definition |
ExampleExample
PHP
functions.php
function prefix_card_attributes( $atts, $card ) {
// We get post in the custom loop of the plugin.
$post = wpgb_get_post();
// If current post ID is equal to 1, change number of rows/columns.
if ( 1 === $post->ID ) {
$atts['rows'] = 1;
$atts['columns'] = 2;
}
return $atts;
}
add_filter( 'wp_grid_builder/card/attributes', 'prefix_card_attributes', 10, 2 );