I'm trying to add the post type as a class in the cards (article element).
I was messing with this:
function set_class_postype( $atts, $card ) {
$grid = wpgb_get_grid_settings(1);
$post_type = get_post_type( $post->ID );
$atts['class'] = $post_type;
return $atts;
}
add_filter( 'wp_grid_builder/card/attributes', 'set_class_postype', 10, 2 );
But that, obviously, only outputs the post type where the grid builder shortcode is. Which is a page. So that is what outputs https://i.stack.imgur.com/IZmE4.png
Found the solution!
I simply added:
So, the final snippet is:
Wooo so excited, this opens the door for so many possibilities