Making WordPress.org

Changeset 4236


Ignore:
Timestamp:
10/14/2016 03:17:33 PM (8 years ago)
Author:
ocean90
Message:

Breathe: Add each site's slug to the body class, so that CSS rules can target specific sites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php

    r4167 r4236  
    106106}
    107107add_action( 'wp_footer', __NAMESPACE__ . '\javascript_notice' );
     108
     109/**
     110 * Adds each site's slug to the body class, so that CSS rules can target specific sites.
     111 *
     112 * @param array $classes Array of CSS classes.
     113 * @return array Array of CSS classes.
     114 */
     115function add_site_slug_to_body_class( $classes ) {
     116    $current_site = get_site( get_current_blog_id() );
     117
     118    $classes[] = 'wporg-make';
     119    if ( $current_site ) {
     120        $classes[] = 'make-' . trim( $current_site->path, '/' );
     121    }
     122
     123    return $classes;
     124}
     125add_filter( 'body_class', __NAMESPACE__ . '\add_site_slug_to_body_class' );
Note: See TracChangeset for help on using the changeset viewer.