Created
November 30, 2016 14:38
-
-
Save sjaved87/82fb39c4d24c44e1f04fa452382a4814 to your computer and use it in GitHub Desktop.
This snippet will add ID to body class like blog-1 if its main site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_site_id_to_body_class( $classes ) { | |
global $post; | |
$current_blog_ID = get_current_blog_id(); | |
$classes[] = 'blog-' . $current_blog_ID; | |
return $classes; | |
} | |
add_filter( 'body_class', 'add_site_id_to_body_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment