Return to Snippet

Revision: 66951
at July 24, 2014 23:25 by razvanstavila


Initial Code
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;
}

Initial URL

                                

Initial Description
Add page name slug to Wordpress body class array.

Initial Title
Wordpress - Add Page Name Slug to Body classes

Initial Tags
class, wordpress

Initial Language
PHP