Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active February 18, 2021 11:05
Show Gist options
  • Save barbwiredmedia/8ef3ab025734074fb874 to your computer and use it in GitHub Desktop.
Save barbwiredmedia/8ef3ab025734074fb874 to your computer and use it in GitHub Desktop.
Wordpress Multisite body class addition and blog conditional.
<?php global $blog_id; ?>
<?php if ($blog_id == 2) { ?>
<?php } elseif ($blog_id == 1) { ?>
<?php } ?>
// Add site-id class to body functions.php
add_filter('body_class', 'multisite_body_classes');
function multisite_body_classes($classes) {
$id = get_current_blog_id();
$classes[] = 'site-id-'.$id;
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment