Different site different div content – Multisite

Do the sites have different wordpress installs? If so, they probably have different names and you could use

<div class="different-content">
if (get_bloginfo('name') == "site-1") {
    // show stuff for blog named "site-1"
} elseif (get_bloginfo('name') == "site-2") {
    // show stuff for blog named "site-2"
} else {
    //if it's not any of the sites above, show this
}
</div>

If they don’t have different names you could do the same with

$host = $_SERVER['HTTP_HOST'];
$subdomain = array_shift((explode(".", $host)));

and checking for the subdomain instead of blog name.


New try.

In your functions.php add a function like this

function check_site($name) {
    if (get_bloginfo('name') == $name) { return true; }
    else { return false; }
}

now in your template (header.php/single.php etc..) you can use it like

<?php if (check_site('site_1')) { ?>
    <div class="div">
    Content for main site
    </div>
<?php } ?>

tech