TechGnome –
1 – My style switcher is located in \wordpress\wp-content\plugins\wp-syle-switcher.php.
2 – Actually, I did, a little, back in April, I think. The original style-switcher expected my blog to be located at \wordpress\index.php, but it’s located in the root folder. That was a long time ago, and I used some instructions I found on these forums to modify it. I’ll post the code in a moment if you think that’ll be of some help. I don’t know php, so much f that coding is greek to me.
3 – The actual styles are located in \wordpress\wp-style\Blue_Swirly\ etc.
Here’s my wp-style-switcher.php code:
<?php
// WP Style Switcher
// version 1.2, 2004-03-03
//
// copyright 2004 Alex King
// https://www.alexking.org/software/wordpress/
/*
Plugin Name: WP Style Switcher
Plugin URI: https://www.alexking.org/software/wordpress/
Description: A CSS Style Switcher for WordPress.
Author: Alex King
Author URI: https://www.alexking.org/
*/
// change this to the name of default style you want to use
$wp_style_default = 'Blue Swirly';
function wp_style_cookie($default = "") {
global $wp_style_default;
if (empty($default)) {
$default = $wp_style_default;
}
$expire = time() + 30000000;
$urlinfo = parse_url(get_settings('home'));
$path = $urlinfo['path'];
$domain = $urlinfo['host'];
if (!empty($_GET["wpstyle"])) {
setcookie("wpstyle"
,stripslashes($_GET["wpstyle"])
,$expire
,$path
,$domain
);
header("Location: ".get_settings('home'));
}
else if (empty($_COOKIE["wpstyle"])) {
setcookie("wpstyle"
,$default
,$expire
,$path
,$domain
);
}
}
function wp_stylesheet($default = "") {
global $wp_style_default;
if (empty($default)) {
$default = $wp_style_default;
}
if (!empty($_COOKIE["wpstyle"]) && file_exists('wordpress/wp-style/'.$_COOKIE["wpstyle"].'/style.css')) {
$style = $_COOKIE["wpstyle"];
}
else {
$style = $default;
}
echo get_settings('siteurl').'/wp-style/'.$style.'/style.css';
}
function wp_style_switcher($in_list = 1, $type = "text", $preview = 0) {
$styles = array();
$path = "wordpress/wp-style/";
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (is_dir($path.$file) && file_exists($path.$file.'/style.css') && substr($file, 0, 1) != '.') {
$styles[] = $file;
}
}
}
closedir($handle);
if (count($styles) > 0) {
asort($styles);
reset($styles);
$ss = '<ul id="styleswitcher">'."\n";
foreach ($styles as $style) {
switch ($type) {
case "sample":
if (file_exists('wp-style/'.$style.'/sample.gif')) {
$sample = get_settings('siteurl').'/wp-style/'.$style.'/sample.gif';
}
else {
$sample = get_settings('siteurl').'/wp-style/sample.gif';
}
$display = '<img src="'.$sample.'" alt="'
.htmlspecialchars($style).'" title="Use this Style" />';
break;
default:
$display = htmlspecialchars($style);
break;
}
if ($preview != 0) {
if (file_exists('wp-style/'.$style.'/screenshot.gif')) {
$display .= '
.'/wp-style/'.$style.'/screenshot.gif">Screenshot';
}
}
if (!empty($_COOKIE["wpstyle"]) && $_COOKIE["wpstyle"] == $style) {
$ss .= '
- '.$display.'
'."\n";
}
else {
$ss .= '
.get_settings('home').'/'.get_settings('blogfilename')
.'?wpstyle='.urlencode($style).'">'
.$display.'
'."\n";
}
}
$ss .= '
';
}
if ($in_list == 1) {
$ss = '<li id="style">Style:'.$ss.'
';
}
echo $ss;
}
wp_style_cookie();
?>