Return to Snippet

Revision: 37733
at December 16, 2010 08:55 by vagrantradio

Initial Code
//place in php tags above DOCTYPE declaration

//Set Default style
$demo_style = "style";

//Retrieve Cookie (if exists)
if( isset($_COOKIE['your-theme-style']) ){

    //Set Style
    $demo_style = $_COOKIE['your-theme-style']; 


//Retrieve Style form URL
if( isset($_GET['style'])){

    //Set Style
    $demo_style = $_GET['style'];

    //Set cookie
    setcookie('your-theme-style', $demo_style);

} ?>

// Put stylesheet link in head
<link href="<?php bloginfo('stylesheet_directory'); ?>/<?php echo $demo_style; ?>.css" rel="stylesheet" type="text/css" media="screen" />

//links in theme page

Initial URL

Initial Description
Easiest way to switch theme styles for WordPress demos.

Initial Title
WordPress Easy Theme Style Switcher

Initial Tags

Initial Language