WordPress Multisite Conditionals?

So I have a wordpress Multisite with about 15 different sites.

Just an example:

Read More

country.com (main site)

  • usa.country.com
  • china.country.com
  • france.country.com

Now lets say in china.country I wanted an h1 tag that says “THIS IS CHINA” on the header BUT not on any other multisite not even the main one. Is there a conditional for that? I checked the wordpress codex but no luck there, only thing I could find was is_main_site() which did not help.

So basically I am looking for a conditional that allows me to select different multisite so I can have different content on them.

Also I am not too familiar with wordpress multisite since this is my first one but I do know that I can also instead of using the multisite feature create a sub directory and install wordpress in that sub directory and it would accomplish the same thing but each multisite files would be separate which sounds good rite about now but im not sure. Any info on how I can have distinct content for each multi site would be appreciated or if I should not even be using multi site and do it manually by created a sub directory and installing wordpress on there.

Thank you.

I forgot to mention that their all using the same theme. So they all
share the same index.php(home) file which means I would need a
conditional to change the look of the other multi sites.

Related posts

Leave a Reply

1 comment

  1. Behind the scenes in WordPress multi-site, each “site” is actually called a “blog” (the “site” is the overall network.) Each of your different blogs will have a different ID. You can fetch the ID using get_current_blog_id.

    To make the code easier to read, though, I’d probably use get_blog_details, which returns an array of information about a blog, including the domain:

    $blog_details = get_blog_details(get_current_blog_id());
    
    echo "This is the {$blog_details->blogname} site!";
    
    if ($blog_details->domain == 'usa.country.com') {
        // I'm in the USA!
    }