/ Published in: PHP
Add page name slug to Wordpress body class array.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
add_filter('body_class', 'add_browser_classes'); function add_browser_classes($classes){ global $wp_query; $page = ''; if(is_page()) { $classes[] = $wp_query->query_vars["pagename"]; } return $classes; }