WordPress.org

Ready to get started?Download WordPress

Forums

CSS Style Switching (2 posts)

  1. dreamwhisper
    Member
    Posted 6 years ago #

    I apologize for starting a new thread, but I realized that where I posted before was marked [resolved]. I'm trying to use the A List Apart method of switching.

    I can't get this method to work to save my life. I've tried several different suggested methods of implementing this without success. In the process, I've now confused myself!

    I have:
    Sidebar
    ´
    <form action="wp-content/themes/crisp/switcher.php" method="post">
    <select name="set">
    <option value="style"> » Spring</option>
    <option value="Pegasus" selected="selected"> » Pegasus</option>
    </select>
    <input type="submit" value="Change Style">
    </form>

    ´

    Switcher.php

    ´
    <?php
    if (isset($_POST['set']))
    {
    setcookie ('style', $_POST['set'], time()+31536000, '/', 'dreamwhisperdesigns.com', '0');
    header("location: " . $_SERVER['HTTP_REFERER']);
    }
    ?>
    ´

    header.php

    ´
    <link rel="stylesheet" type="text/css" media="screen" title="Pegasus" href="<?php bloginfo('template_directory'); ?>/<?php echo (!$_COOKIE['style'])?'Pegasus':$_COOKIE['style'] ?>.css" />
    <link rel="stylesheet" type="text/css" media="screen" title="Spring" href="<?php bloginfo('template_directory'); ?>/style.css" />

    ´

    I've tried everything - full urls, different combinations, etc.
    ´
    <link rel="stylesheet" type="text/css" media="screen" title="Spring" href="<?php echo (!$_COOKIE['sitestyle'])?'style':$_COOKIE['sitestyle'] ?>.css" />
    ´
    What am I missing?

  2. Nessdufrat
    Member
    Posted 5 years ago #

    Up for this, I have the same problem...

Topic Closed

This topic has been closed to new replies.

About this Topic