Add a unique class to HTML tag/element


I know there is a body_class function for WordPress. But is there one (or a way) to add a class to the HTML element?

My goal is to be able to add a unique class (or ID) to a page’s HTML element. Currently my theme is adding the page-id-XXXX class to the body element, but I need a way to have a unique class or ID on the actual HTML element. I’d probably be fine having the page-id-XXXX also added onto the HTML element, although I’d prefer being able to have a custom field that’s added to each page, where I can type in the class/ID that would then get added to the HTML element.

At the very least, is there a function I can use to add a class or ID to the HTML element, similar to how the body_class function works?

Garconis 8 months 2020-12-10T17:10:26-05:00 0 Answers 10 views 0

Leave an answer