Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Created November 30, 2016 14:38
Show Gist options
  • Save sjaved87/82fb39c4d24c44e1f04fa452382a4814 to your computer and use it in GitHub Desktop.
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.
<?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