SOLVED: Sorry. My bad. If I understand it correct the first part is only for modifing an existing array of classes. When I want to add only a single class the second part works perfect when I replace data-is-header with class.
@thomas unfortunately, I’m not really experienced with filters yet.
That they come in the WP Codebox or function.php of the Childthemes is clear to me, but when I try to combine the CSS Class code from above with the new filter for the tag, it adds (because I wanted to test it) the custom attribute, but unfortunately not the CSS Class.
Am I doing something wrong?
add_filter( 'bricks/content/attributes', function( $attributes ) {
// Add custom class to header
if ( is_array( $attributes['class'] ) ) {
$attributes['class'][] = 'contentgrid';
}
// Add 'data-is-header' HTML attribute to header with value 'y'
$attributes['data-is-header'] = 'y';
return $attributes;
} );