WordPress.org

Ready to get started?Download WordPress

Forums

Template or CSS Switcher with cookie handling (17 posts)

  1. Laughinglizard
    Member
    Posted 10 years ago #

    Maybe I am going overboard with this template deal, or maybe this has been discussed before (I do remember seeing a bunch of posts on the tikada site about cookie based theme switching). Please ignore/delete this post if that is the case. However, I found a really interesting article at A List Apart dot com about dynamic stylsheet changes using a simple javascript and storing the information as a cookie. I was really itching to try it out with all the talk in the WordPress Forums about retro stylesheets for WordPress. Check out the switcher at http://dinki.mine.nu/weblog/ On the top right hand side of the menu you will see the themes I have installed for my version of WordPress, albeit with a few modifications to suit my second menu column. Feel free to play around and see which one you like best. If you would like to implement this on your site ( no matter which CMS you use, this will work for you ) simply visit the List Apart link above, download the javascript and follow the instructions. If you are confused, feel free to email me and I will try to help.
    PS: once you choose a templte/style, a cookie is set on your computer which remembers your choice for the next time :-) The themes break in Mozilla (for now) and do not degrade well, but thats not the point of this exercise

  2. southerngal
    Member
    Posted 10 years ago #

    I have used a .CSS cookie switcher with b2 and now WP for over a year. I have a tutorial here: http://www.gnshosting.com/tutorials.php
    The method I use works in all browsers, including Safari for Mac, as far as I know. :)
    Good resource you have listed, thanks!

  3. BendeGroot
    Member
    Posted 10 years ago #

    For those who, like me, want to avoid JavaScript, I have some simple PHP scripts that work at http://www.stijlstek.nl/archief/2003/10/29/php_styleswitcher.php - the scripts are clear enough I think, but if you need translation (the article is in Dutch) I can provide it.

  4. BendeGroot
    Member
    Posted 10 years ago #

    PHP rules! I actually didn't look at your tutorial, because I don't want to download a Word.doc. I try to avoid Microsoft as much as possible (except for Dungeon Siege that is). Couldn't you put the tutorials in XHTML (or even just txt) instead of some proprietary format?
    A translation of my little PHP StyleSwitcher article will be up as soon as I either a) get WordPress CVS-version working or b) get a working version of my own blog software.

  5. Xial
    Member
    Posted 10 years ago #

    Ben de Groot: I'm looking forward to the translation, myself. A lot of my friends and visitors surf with JavaScript disabled (And I can't blame 'em), and having a PHP alternative would be great for me. :3
    Hopefully, you'll get that CVS version of WordPress working soon, then. :3

  6. Michael Heilemann
    Member
    Posted 10 years ago #

    Just wanted to let you know that you can see it in action at my site.

  7. notthatugly
    Member
    Posted 10 years ago #

    ALA also has a simple php switcher which I'm using on my blog; it sets cookies, is Mozilla-friendly and uses no javascript.

  8. Anonymous
    Unregistered
    Posted 10 years ago #

    Or you can go to domesticat's tutorial. That's what I use for my blog. A simpler tutorial (derived from domesticat) can be found at ice-star

  9. southerngal
    Member
    Posted 10 years ago #

    I used Amy's tutorial to create mine. :)

  10. gfmorris
    Member
    Posted 10 years ago #

    I'm talking to Amy right now. ;)
    GFM <-- random comment, but hey ... I've known Amy for years :D

  11. southerngal
    Member
    Posted 10 years ago #

    I have put up a tutorial here :: Word Press Hacks

  12. Orbit Juice
    Member
    Posted 10 years ago #

    Woah... I got mentioned in a hack lol

  13. southerngal
    Member
    Posted 10 years ago #

    Nick, you helped me so much with that! :) Thank you!

  14. Laughinglizard
    Member
    Posted 10 years ago #

    @anatman:
    That will work as well. You would have to modify the code very slightly. For an example of how this would work, just download a copy of WW from here:
    http://weblogtoolscollection.com/archives/2004/03/07/wuhwuh-01-release-candidate-1/
    WW already has these 2 hacks built in and you can look at the code to see the changes. :-)

  15. anatman
    Member
    Posted 10 years ago #

    Thanks, LL!

  16. simplykimberly
    Member
    Posted 9 years ago #

    I used the ALA switcher and it works great in Mozilla. However, when I open it in Internet Explorer the style is not applied.
    Anyone know what I am doing wrong?

  17. simplykimberly
    Member
    Posted 9 years ago #

    Never mind. I figured it out. I put the default stylesheet link inside of the <STYLE> tag. I took it out and placed it outside of the tag and now it works in both Mozilla and Internet Explorer.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.