Return to Snippet

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


Initial Code
//place in php tags above DOCTYPE declaration
<?php 

//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
http://www.yoursite.com/yourtheme/?style=style
http://www.yoursite.com/yourtheme/?style=another_style
http://www.yoursite.com/yourtheme/?style=yet_another_style

Initial URL
http://www.mojo-themes.com/demo/stereotype-one-page-wordpress-theme/

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

Initial Title
WordPress Easy Theme Style Switcher

Initial Tags
wordpress

Initial Language
PHP