kaioe
2/5/2018 - 11:28 PM

multisite_body_classes

  • [multisite_body_classes description]
  • Add the site-domain-name to body classes

/**
 * [multisite_body_classes description]
 * Add the site-domain-name to body classes
 */
function multisite_body_classes($classes) {

        $id = get_current_blog_id();
        $details = get_blog_details($id);
        $domain  = explode('.', $details->domain);

        if (is_array($classes)) {
          $classes[] = $domain[1];
        }else{
          $classes .= $domain[1];
        }
        return $classes;
}
add_filter('body_class', 'multisite_body_classes');
add_filter('admin_body_class', 'multisite_body_classes');