Reputation: 45
I am stuck with the function network_site_url()
and the if
statement. I want to show different content via my different Multisite.
Here is the code:
$url= network_site_url();
if ($url=='string-url'){
the_content( __( 'example1 <span class="meta-nav">→</span>', 'esquire' ) ); }
else{
the_content( __( 'example2 <span class="meta-nav">→</span>', 'esquire' ) ); }
In fact the string value of the $url variable must be either http://www.example.com
or http://www.example.com/it
.
How to do it?
Upvotes: 1
Views: 396
Reputation: 45
Thank you for your help. I've tried and it works pretty well.
I found also another way.
global $current_blog;
if($current_blog-> blog_id == 2){
//content }
else{
//content}
Upvotes: 0
Reputation: 26065
You are looking for get_current_blog_id()
, network_site_url()
is to simply "Retrieve the site url for the current network.".
switch( get_current_blog_id() )
{
case 1:
echo 'main site';
break;
case 43:
echo 'site #43');
break;
}
Upvotes: 1