Completed
Push — master ( a15787...f8bba6 )
by SILENT
02:27
created

extras.php ➔ strip_body_classes()   C

Complexity

Conditions 8
Paths 64

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 14
nc 64
nop 1
dl 0
loc 27
rs 5.3846
c 0
b 0
f 0
1
<?php
2
/**
3
 * Custom functions that act independently of the theme templates
4
 *
5
 * Eventually, some of the functionality here could be replaced by core features.
6
 *
7
 * @package WordPress
8
 * @subpackage Strip
9
 * @since 1.1.2
10
 */
11
12
/**
13
 * Adds custom classes to the array of body classes.
14
 *
15
 * @param array $classes Classes for the body element.
16
 * @return array
17
 */
18
function strip_body_classes( $classes ) {
19
	// Adds a class of group-blog to blogs with more than 1 published author.
20
	if ( is_multi_author() ) {
21
		$classes[] = 'group-blog';
22
	}
23
	// Add class of hfeed to non-singular pages.
24
	if ( ! is_singular() ) {
25
		$classes[] = 'hfeed';
26
	}
27
	// Add class if we're viewing the Customizer for easier styling of theme options.
28
	if ( is_customize_preview() ) {
29
		$classes[] = 'strip-customizer';
30
	}
31
	// Add class on front page.
32
	if ( is_front_page() && 'posts' !== get_option( 'show_on_front' ) ) {
33
		$classes[] = 'strip-front-page';
34
	}
35
	// Add a class if there is a custom header.
36
	if ( has_header_image() ) {
37
		$classes[] = 'has-header-image';
38
	}
39
	// Add class if the site title and tagline is hidden.
40
	if ( 'blank' === get_header_textcolor() ) {
41
		$classes[] = 'title-tagline-hidden';
42
	}
43
	return $classes;
44
}
45
add_filter( 'body_class', 'strip_body_classes' );
46