I am battling with the following:
$themeId = "";
$pathname = get_site_url();
if($pathname == 'domain2.com'){
$themeId = "gold";}
else{
$themeId = "blue";}
wp_register_style('theme-skin',THEMEURI . '/css/'.get_option($themeId).'-style.css', 3 , false, 'all');
So basically, I have a domain, domain1.com. It uses a blue theme for wordpress and hence the blue stylesheet which is: blue-style.css.
Now, I have another domain name, domain2.com, that uses the exact same wordpress installation. So I want to get the current url in the address bar, and based on that, change the color scheme, blue for domain1.com and gold for domain2.com.
But my code above does not work, it keeps using blue, no matter what url is visited - What am I doing wrong here?
Thanks
UPDATE: The original Default code
theme.css
if(get_option(THEMESLUG."_17_style")){
wp_register_style('theme-skin',THEMEURI . '/css/'.get_option( THEMESLUG."_17_style").'-style.css', 3 , false, 'all'); //dark skin
}
Where the colors are specified: styling-options.php
array(
"name" => __("Theme Style",'rt_theme_admin'),
"desc" => __("Please choose a style for your theme.",'rt_theme_admin'),
"id" => THEMESLUG."_17_style",
"options" => array(
"blue" => "Blue Style",
"purple" => "Purple Style",
"orange" => "Orange Style",
"brown" => "Brown Style",
"rose" => "Rose Style",
"green" => "Green Style",
"grey" => "Grey Style",
"gold" => "Gold Style",
),
"default" => "blue",
"type" => "select"),
SOLVED
Hi All. I did the following, and it now works:
if ( 'domain2.com' === $_SERVER['HTTP_HOST'] ) {
wp_register_style('theme-skin',THEMEURI . '/css/gold-style.css', 3 , false, 'all');
} else {
wp_register_style('theme-skin',THEMEURI . '/css/blue-style.css', 3 , false, 'all');
}