Hi there
We currently have a custom field called ‘brand’ and it is a Select field type.
The brand values are parkland, toro, pope, grillo, yamaha etc
We are using the body_class filter for inserting a brand value into the body class. We are using it within pages, products, product_cat, posts. We are using it to theme the page with different colours
Below is the function we have in functions.php
add_filter( 'body_class', 'brand_class' );
function brand_class( $classes ) {
if ( $brand = get_field( 'brand') ) {
$brand = esc_attr( trim( $brand ) );
$classes[] = $brand;
}
return $classes;
}
It has been working fine up until now but we have introduced a Product category that now includes different products with differing brands.
This product category page https://www.parkland.co.nz/products/parkland-pre-owned/ has the brand ‘parkland’ associated with it but the brand that is showing for the page is ‘toro’.
My question is how do I get the brand for the product_cat without it somehow getting the brand value from the product (assuming the first product in the list)
I hope I’ve explained myself clear enough
Cheers
Anthony