Last active
February 18, 2021 11:05
-
-
Save barbwiredmedia/8ef3ab025734074fb874 to your computer and use it in GitHub Desktop.
Wordpress Multisite body class addition and blog conditional.
This file contains hidden or 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 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