How to add Page slug as a body class for static Pages in WordPress – Sridhar Katakam

A common method to target elements of a particular static Page is by its ID like this: .page-id-2 Wouldn’t it be handy if you could instead use the slug of the Page like this? .page-about Adding the following in child theme’s functions.php will automatically add a page-slug class to the…

This content was originally published here.