Style Switcher refresh problem
-
Hi I’ve installed Alex’s Style Switcher plugin and on the whole it works very well. I can change themes, I’ve set the default theme and so on.
I have found a quirk though and was wondering if anyone had any thoughts.
I have set my default theme per the readme by putting the style name as an argument inindex.php:
@import url( <?php wp_stylesheet("dots"); ?> );
I have removed the cookie for my site. When I go to the front page I see my selected theme. If I then do a browser refresh and it returns to the default theme. The reason appears to be is that the newly created cookie has
wpstyle
wp-default
as the first two lines.
The problem appears to occur because a cookie is being created before the theme is set (or at the same time, not knowing how php or wordpress works under the covers).
Looking closely at the plugin file I note that the functionwp_style_cookie();is being called. My guess is that when you load a page, the plugins are checked, as the style switcher is active, its loaded and as there is no cookie it creates one with thewp-defaulttheme set, the page is then loaded with the override set in index.php, when a refresh occurs the process starts again but this time there is a cookie and its style is used instead?
Rob
The topic ‘Style Switcher refresh problem’ is closed to new replies.