0
votes

I've trawled through a tonne of forums and nothing I find works. I'm using my own theme which is a blank one. I've impemented Woocommerce but I cant seem to get the body classes into the template

Desired

Categories to have the product-category class in the body tag Products to have the single-product class in the body tag

Can anyone help as I'm feeling the results in finding are outdated

1
Are you not following WordPress theming conventions and using body_class()? If you are, then you will get those classes by default.helgatheviking

1 Answers

2
votes

Open your theme and check in header.php whether your theme body tag has body_class() function called or not. If not you can call it like this

<body <?php body_class( 'your-custom-class-name' ); ?>>

For more details, you can read WP codex here https://developer.wordpress.org/reference/functions/body_class/