• Hi,
    I have installed Alex’s style switcher, as i was impressed with the designs running for the CSS Style competition. But i can’t make it work. No errors are generated – i have made up the directory structure as instructed in the readme, as well as the other changes. When i load the page, it is displayed with NO style at all, unless i set one style as the default one, and then only that style will be displayed. The style list (and it’s links to the other styles) is correctly generated, but when i click a link the page is loaded with the default style again.
    What i could tell is that the hack is not setting a cookie (as it should): i trashed all cookies and reloaded the page, then selected some styles, and when i looked at the cookie list there was nothing there. Ah, and my browser works ok to see Alex’s page, with switching atyles and all.
    All help appreciated!
    Thanks,
    Eduardo

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter anatman

    (@anatman)

    And adding to all that: if i pass in the name of the style i want to use as the default like this:
    <?php wp_style_cookie(“my-new-style”); ?>
    It also doesn’t work.

    The first line of my wp-style-switcher.php has this :
    function wp_style_cookie($default = “white”) {
    The first line of my my-hacks.php is this;
    ?php require_once(‘wp-style-switcher.php’); ?
    ?php wp_style_cookie(); ?
    (with pointy brackets)
    Is yours the same ?

    Did you read the thread about the style switcher? I have a link in there to an easy tutorial for it. It tells you where the code should go and what code. 🙂 http://southern-designs.com has it on the hacks link. 🙂

    Thread Starter anatman

    (@anatman)

    podz: if i make that first line look like yours (only using a style i have, “blue” for example), still nothing happens. If i try to pass the default style when i call the wp_style_cookie() function from the my-hacks.php file, as explained in the readme, nothing happens also. I only get a style, an unchangeable one, if i set it using $wp_style_default = ‘somestyle’; in the wp-style-switcher.php file. The only two lines in my my-hacks.php file are those:
    ?php require_once(‘wp-style-switcher.php’); ?
    ?php wp_style_cookie(); ?
    with the pointy brackets. Should i have any more lines there??
    so-gal: yes, i had read the thread, but i just went to your website and followed the all the steps in the tutorial to make sure i wasn’t forgetting anything. As far as i can tell i wasn’t. See, the only wrong thing going on is that i cannot change the styles (no cookie). The style list _is_ displayed in my website, which would indicate that my-hacks.php is loading, and that the wp_style_switcher() function is working too. And if i set a default style using $wp_style_default = ‘somestyle’; in the wp-style-switcher.php file, a style (unchangeable) is used, which would indicate that the call @import url( <?php wp_stylesheet(); ?> ); is working and the styles are being found in their directories. So i would say it comes down to the wp_style_cookie() function, which is either not working or i am not calling correctly.
    One could say i have some weird setting in the browser preventing the cookies – but i have turned it off for testing this – and GamerZ WP-Polls hack was being able to set a cookie… All i can see is that when i pont my browser to http://localhost/~eduardo/wp/index.php?wpstyle=blue, that url will not stay in the address bar, and will be substituted by just http://localhost/~eduardo/wp/index.php. Is that right?
    Thanks

    What did you do with the wp-style directory? Did you make a default directory in there like I said to in the tutorial? It will work if you follow the directions…honest! 🙂
    I think maybe you should print out the tutorial I wrote for it and try it from scratch. It shouldn’t take more than 10 minutes from top to bottom. You probably have code in there from your previous attempts and that’s making your head spin.

    Thread Starter anatman

    (@anatman)

    The wp-style directory is in my blog root, together with my-hacks and wp-style-switcher. Inside wp-style there are 4 directories named after their styles. Inside each one is the syle.css file, and any gifs needed.
    I sware i folowed the tutorial carefully three times over 🙁

    if u want to check out something else, there is always a list apart code…
    http://www.alistapart.com/articles/alternate/

    Thread Starter anatman

    (@anatman)

    In the end i decided to upload the code to my website, even if it was not working, with a default style selecte. I was testing it locally in my computer (running Apache etc.). To my surpreise i worked without any further adjustments! It only doesn’t work locally, i have no idea why…
    Thanks So-gal, Sushubh and podz for the help.

    cookies on local server? that should have worked. 🙂

    Thread Starter anatman

    (@anatman)

    he he, i see i just tested it!
    thanks a lot for your help, Sushubh and so-gal, and Alex thanks for the code and for comming to help too.

    I ran into the same problem with the style switcher while testing locally. I also want to run my site locally using a DNS forwarding service, so what worked for me is going into the WP admin>Options>Base Settings and changing the siteurl from http://localhost to the actual url that I’m using through my DNS forwarding service.
    If you’re just testing locally, it’s no big deal. But if you plan on serving your website from your own computer, I hope this helps 🙂

    Hi, I confirm than using the the css-switcher doesn’t work locally for me either. I didn’t check if *any* cookies works on my localhost and since I’m running on a dynamic IP, I can’t change the settings each time I try a new feature.
    I tried using the localhost IP adress. Same problem. But it’s an Internet Explorer problem, it works fine on Opera and Firefox, so for debugging purpose switch ! 😉
    iko;-)

    It’s a cookie issue – no workaround that I know of.

    I had the same problem NO COOKIE was getting set when accessing localhost…. for any borwser, IE, Mozi, FF….. BUT, once I moved it to the live site, it worked. so…..
    When I was running WP out of a subfolder localhost/wordpress cookies seemed to be fine. It wasn’t until I move it all up to the lh root that I experienced problems.
    TG

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘CSS Switcher: can’t make it work’ is closed to new replies.