php - WordPress Network Installation: How to get the ID of the site being viewed -


I have a network site installation with 4 different sub-sites using a subdirectory style: domain.com/ Ger, domain .com / fra, domain.com/esp, etc.

All the above sites are using the same theme / templates.

In one of my files, I want to add a pair of sites based on the lines of custom content.

So I thought there should be a way to get the sub-site ID, when a user sees a page and then displays specific content for that sub-site.

Like something, maybe:

   

But I can not understand how the sub-site ID will get when the page is loaded.

Any ideas will be highly appreciated.

Use get_current_blog_id () -

  $ Blog_id = get_current_blog_id (); Switch ($ blog_id) {case 2: // content here ... break; Case 3: // Optional content ... break; Default: // is not matched up to Content ID ...}  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -