/card/attributes
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
Argument | Type | Description |
$atts | array | Holds card attributes |
$card | object | Holds card layout (layers/blocks) definition |
[pastacode lang=”php” manual=”function%20prefix_card_attributes(%20%24atts%2C%20%24card%20)%20%7B%0A%0A%09%2F%2F%20We%20get%20post%20in%20the%20custom%20loop%20of%20the%20plugin.%20%0A%09%24post%20%3D%20wpgb_get_post()%3B%0A%0A%09%2F%2F%20If%20current%20post%20ID%20is%20equal%20to%201%2C%20change%20number%20of%20rows%2Fcolumns.%20%0A%09if%20(%201%20%3D%3D%3D%20%24post-%3EID%20)%20%7B%20%0A%0A%09%09%24atts%5B’rows’%5D%20%3D%201%3B%0A%09%09%24atts%5B’columns’%5D%20%3D%202%3B%0A%09%0A%09%7D%0A%0A%09return%20%24atts%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Fcard%2Fattributes’%2C%20’prefix_card_attributes’%2C%2010%2C%202%20)%3B” message=”” highlight=”” provider=”manual”/]