Posted By

razvanstavila on 07/24/14


Tagged

class wordpress


Versions (?)

Wordpress - Add Page Name Slug to Body classes


 / Published in: PHP
 

Add page name slug to Wordpress body class array.

  1. add_filter('body_class', 'add_browser_classes');
  2. function add_browser_classes($classes){
  3. global $wp_query;
  4. $page = '';
  5. if(is_page()) {
  6. $classes[] = $wp_query->query_vars["pagename"];
  7. }
  8.  
  9. return $classes;
  10. }

Report this snippet  

You need to login to post a comment.