• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentyseventeen_body_classes() – Adds custom classes to the array of body classes.

You appear to be a bot. Output may be restricted

Description

Adds custom classes to the array of body classes.

Usage

$array = twentyseventeen_body_classes( $classes );

Parameters

$classes
( array ) required – Classes for the body element.

Returns

array

Source

File name: twentyseventeen/inc/template-functions.php


Lines:

1 to 53 of 53
function twentyseventeen_body_classes( $classes ) {
  // Add class of group-blog to blogs with more than 1 published author.
  if ( is_multi_author() ) {
    $classes[] = 'group-blog';
  }

  // Add class of hfeed to non-singular pages.
  if ( ! is_singular() ) {
    $classes[] = 'hfeed';
  }

  // Add class if we're viewing the Customizer for easier styling of theme options.
  if ( is_customize_preview() ) {
    $classes[] = 'twentyseventeen-customizer';
  }

  // Add class on front page.
  if ( is_front_page() && 'posts' !== get_option( 'show_on_front' ) ) {
    $classes[] = 'twentyseventeen-front-page';
  }

  // Add a class if there is a custom header.
  if ( has_header_image() ) {
    $classes[] = 'has-header-image';
  }

  // Add class if sidebar is used.
  if ( is_active_sidebar( 'sidebar-1' ) && ! is_page() ) {
    $classes[] = 'has-sidebar';
  }

  // Add class for one or two column page layouts.
  if ( is_page() || is_archive() ) {
    if ( 'one-column' === get_theme_mod( 'page_layout' ) ) {
      $classes[] = 'page-one-column';
    } else {
      $classes[] = 'page-two-column';
    }
  }

  // Add class if the site title and tagline is hidden.
  if ( 'blank' === get_header_textcolor() ) {
    $classes[] = 'title-tagline-hidden';
  }

  // Get the colorscheme or the default if there isn't one.
  $colors    = twentyseventeen_sanitize_colorscheme( get_theme_mod( 'colorscheme', 'light' ) );
  $classes[] = 'colors-' . $colors;

  return $classes;
}
 

 View on GitHub View on Trac

Published: 8th April 2020 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: twentyseventeen_body_classes
Plugin ref: Twenty Seventeen
Version: 3.1
Sourcefile: inc/template-functions.php
File ref: inc/template-functions.php
Deprecated?: No
API Letters: B,C,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites