twentyfourteen_body_classes

Extend the default WordPress body classes.

Description

(array) twentyfourteen_body_classes( (array) $classes ); 

Adds body classes to denote: 1. Single or multiple authors. 2. Presence of header image except in Multisite signup and activate pages. 3. Index views. 4. Full-width content layout. 5. Presence of footer widgets. 6. Single views. 7. Featured content layout.

Returns (array)

The filtered body class list.

Parameters (1)

0. $classes (array)
A list of existing body class values.

Usage

  1. if ( !function_exists( 'twentyfourteen_body_classes' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // A list of existing body class values. 
  5. $classes = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = twentyfourteen_body_classes($classes); 
  9.  

Defined (1)

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

/functions.php  
  1. function twentyfourteen_body_classes( $classes ) { 
  2. if ( is_multi_author() ) { 
  3. $classes[] = 'group-blog'; 
  4.  
  5. if ( get_header_image() ) { 
  6. $classes[] = 'header-image'; 
  7. } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) { 
  8. $classes[] = 'masthead-fixed'; 
  9.  
  10. if ( is_archive() || is_search() || is_home() ) { 
  11. $classes[] = 'list-view'; 
  12.  
  13. if ( ( ! is_active_sidebar( 'sidebar-2' ) ) 
  14. || is_page_template( 'page-templates/full-width.php' ) 
  15. || is_page_template( 'page-templates/contributors.php' ) 
  16. || is_attachment() ) { 
  17. $classes[] = 'full-width'; 
  18.  
  19. if ( is_active_sidebar( 'sidebar-3' ) ) { 
  20. $classes[] = 'footer-widgets'; 
  21.  
  22. if ( is_singular() && ! is_front_page() ) { 
  23. $classes[] = 'singular'; 
  24.  
  25. if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { 
  26. $classes[] = 'slider'; 
  27. } elseif ( is_front_page() ) { 
  28. $classes[] = 'grid'; 
  29.  
  30. return $classes;