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
Post a Comment