Support

Account

Home Forums General Issues Adding brand class to body tag not showing on first level product categories

Helping

Adding brand class to body tag not showing on first level product categories

  • Hi All

    Built a simple Woocomerce site and am using ACF to add branding.

    I am using the following filter to add a brand to the body class (see below)

    function brand_class( $class ) {
    
        if ( $branding = get_field( 'branding') ) {
    
            $branding  = esc_attr( trim( $branding ) );
    
            $class[]       = $branding;
        }
    
        return $class;
    }
    add_filter( 'body_class', 'brand_class' );

    This filter is working perfectly for pages, posts and products BUT it’s doing something weird with product categories. It seems to only work for sub categories or 2nd level down categories, not first level categories.

    Location Rule is set to: Taxonomy is equal to ALL

    Has anyone experienced this issue?

    Thanks for any help in advance

  • Anyone experienced this issue?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Adding brand class to body tag not showing on first level product categories’ is closed to new replies.