body_class

Display the classes for the body element.

Description

body_class( (string) $class = '' ); 

Parameters (1)

0. $class — Optional. (string) => ''
One or more classes to add to the class list.

Usage

  1. if ( !function_exists( 'body_class' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-template.php'; 
  3.  
  4. // One or more classes to add to the class list. 
  5. $class = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = body_class($class); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post-template.php  
  1. function body_class( $class = '' ) { 
  2. // Separates classes with a single space, collates classes for body element 
  3. echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';