I have a site that style is defined by the "default" or "cookie" cookie
However, if you enter the first time on it it saves the cookie with the default value, but does not assume the style.
It only works when you reload the page.
On the first line of the header.php page you have:
<?php require('/style/css_cookie_check.php'); ?>
in the stylesheet part:
<link id="style_cor" rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style/<?php echo $estilo_cor; ?>/style.css" type="text/css" media="screen" />
On the "css_cookie_check.php" page:
<?php
global $estilo_cor;
if(!isset($_COOKIE['cor_estilo'])) {
$estilo_cor = setcookie('cor_estilo', 'padrao', (time() + (2 * 3600)));
} else {
$estilo_cor = $_COOKIE['cor_estilo'];
}
?>