• Has anyone been able to implement as style switcher on their site using the styleswitcher.js method from ALA? I did it on an MT site a little over a month ago but can’t figure it out in WP. You can see what I did at https://year.sniper8.com. If you’d like to see the code that’s cool, of course, but does anyone know how to replicate what I did there on WP? Thanks.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Anonymous

    I’ve gotten it to almost work on WP, but it’s mixing style sheets rather than replacing them. You can see what I mean at https://not.sniper8.com.

    Thread Starter Anonymous

    No longer mixing CSS. Rather, it now loads without a style sheet until one is selected. I’m close now. And I learned that using the standard WP CSS isn’t an option, so I replaced Standard with Dots.

    I got it perfectly working on WP, and the style are not “mixing” at all. From what I can see on your test site, it’s working too.

    Thread Starter Anonymous

    Yeah, pretty much now, but it isn’t loading a “Basic Theme,” as Firebird calls it. So when somebody visits the site for the first time, or after cleaning cookies, they’ll see a style-less page.

    Thread Starter Anonymous

    Did it. It seems every time I ask for help I figure it out on my own. Anyhow, I was including a title attribute and so effectively eliminating it’s persistence. No persistant style sheet=no Basic Theme. If you like the way it works on my site, I’ll be happy to share the index code.

    Thread Starter Anonymous

    Crap, it’s mixing them again, but I have an idea now.

    Thread Starter Anonymous

    Nope that didn’t work. And I just went back to my MT site and found that my basic theme there is no theme at all. Oh well. How can make the site load with a specific theme if no cookie is present without making the style sheet persistent?

    It’s working fine for me. I have 1 master css file + 4 themes. The HTML code is:
    <link rel="stylesheet" type="text/css" media="all" href="myfiles/main.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="myfiles/blue.css" title="Default" />
    <link rel="alternate stylesheet" type="text/css" media="screen" href="myfiles/brown.css" title="brown" />
    <link rel="alternate stylesheet" type="text/css" media="screen" href="myfiles/green.css" title="green" />
    <link rel="alternate stylesheet" type="text/css" media="screen" href="myfiles/moz.css" title="moz" />
    <link rel="stylesheet" type="text/css" media="print" href="myfiles/print.css" />

    As you can see, 1 theme (blue) is defined as a “stylesheet” – not as an “alternate stylesheet”, so
    it will always load if no choice or cookie are set.

    I have a setup where I intentionally “mix” or cascade stylesheets – if you go to my site ( https://www.nodecam.com ) you’ll see two dropdowns in the menu – one for color, and one for layout. I actually have the code in there to customize the fonts as well, but I only have one font style at the moment.
    I started out with a B2 blog, and had the same .js include there that I’m using now – haven’t changed it since Feb 2002. I had to update my styles (to use different entity ids etc) when I migrated to WordPress last week.
    I thought it was a fun thing to do anyway – didn’t require a whole lot of changes to the default wordpress index.php either.

    Thread Starter Anonymous

    My problem was that I either set the style sheet I wanted as default either as persistent or as an alternate, the whole time needing to set it as preferred. Like I said though, I’ve fixed it and am happy with it. Thanks.

    Thread Starter Anonymous

    Hmmm – what did you change between your first posts, where the styles were mixing, and you subsequent posts where they weren’t? I’m definitely having the same problem where switching from the default style to another leaves many different parts of the default style in use. Best I can tell, I’m using the same “alternate stylesheet” syntax.

    Thread Starter Anonymous

    NM. Looks like the trick was to add the “default” style both as “stylesheet” and as “alternate stylesheet”, with the same name attribute.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘styleswitcher.js implementation’ is closed to new replies.