3 * Additional features to allow styling of the templates
6 * @subpackage Twenty_Seventeen
11 * Adds custom classes to the array of body classes.
13 * @param array $classes Classes for the body element.
16 function twentyseventeen_body_classes( $classes ) {
17 // Add class of group-blog to blogs with more than 1 published author.
18 if ( is_multi_author() ) {
19 $classes[] = 'group-blog';
22 // Add class of hfeed to non-singular pages.
23 if ( ! is_singular() ) {
27 // Add class if we're viewing the Customizer for easier styling of theme options.
28 if ( is_customize_preview() ) {
29 $classes[] = 'twentyseventeen-customizer';
32 // Add class on front page.
33 if ( is_front_page() && 'posts' !== get_option( 'show_on_front' ) ) {
34 $classes[] = 'twentyseventeen-front-page';
37 // Add a class if there is a custom header.
38 if ( has_header_image() ) {
39 $classes[] = 'has-header-image';
42 // Add class if sidebar is used.
43 if ( is_active_sidebar( 'sidebar-1' ) && ! is_page() ) {
44 $classes[] = 'has-sidebar';
47 // Add class for one or two column page layouts.
48 if ( is_page() || is_archive() ) {
49 if ( 'one-column' === get_theme_mod( 'page_layout' ) ) {
50 $classes[] = 'page-one-column';
52 $classes[] = 'page-two-column';
56 // Add class if the site title and tagline is hidden.
57 if ( 'blank' === get_header_textcolor() ) {
58 $classes[] = 'title-tagline-hidden';
61 // Get the colorscheme or the default if there isn't one.
62 $colors = twentyseventeen_sanitize_colorscheme( get_theme_mod( 'colorscheme', 'light' ) );
63 $classes[] = 'colors-' . $colors;
67 add_filter( 'body_class', 'twentyseventeen_body_classes' );
70 * Count our number of active panels.
72 * Primarily used to see if we have any panels active, duh.
74 function twentyseventeen_panel_count() {
79 * Filter number of front page sections in Twenty Seventeen.
81 * @since Twenty Seventeen 1.0
83 * @param $num_sections integer
85 $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 );
87 // Create a setting and control for each of the sections available in the theme.
88 for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
89 if ( get_theme_mod( 'panel_' . $i ) ) {
98 * Checks to see if we're on the homepage or not.
100 function twentyseventeen_is_frontpage() {
101 return ( is_front_page() && ! is_home() );