• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

HELP: Theme Switcher plugin for WordPress

Andrej

New Member
I'm going to launch my own "free WordPress themes" site wpmix.com and I would also like to have a live demo (test run) for each theme. I'd like to work the demos on another Wordpress installation in folder wpmix.com/wpdemos/

However, the problem is I don't know how to get it working. I don't want to install new Wordpress for each of my themes. That would take too much time and too many databases...

I think it's possible to get the demos working with the URLs like e.g.:
http://wpmix.com/wpdemos/index.php?wtheme=bluesense
http://wpmix.com/wpdemos/index.php?wtheme=techdesign

But this doesn't work. I have the themes uploaded in the wpdemos folder and I've also installed the "Theme Switcher" plugin (downloaded from wordpress.org). So in the default theme on wpmix.com/wpdemos/ you can change themes, but I need exact URL for demo of each theme, so that I could link to particular demos from other sites.

Anyone could help me to get this working? Rep+ will be added.
 
Assuming you only need different CSS layouts, this is supereasy. Go to the header.php of your current theme (you'll need to do this for every theme you switch to), then edit the following line:
PHP:
/* make: */
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

/* into: */
<link rel="stylesheet" href="<?php if(isset($wtheme)) echo $wtheme . '.css'; else bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
should probably echo the site_url (or whatever it's called) before the $wtheme.'.css';, check the WP Codex for the exact variable on that one.

If you want entire themes to be different... You'll probably need to code a custom solution. AFAIK the last theme_switcher coded was either not functional/bugfree, or only works with really old WP versions. Or you could put a similar conditional clause in each of your theme's pages and use some creative directory organizing:
PHP:
<?php if(isset($wtheme)) require_once ("$wtheme/this_file.name"); 
else{
/* normal file, then at the very end: */
}
It's a bit of a hassle, but should be an easy-to-do solution. Easy as in little technical knowledge required.

Hope this helped rather than confuse you more :fangel:
 
Thank you very much for your help. However, I already got this problem resolved. It didn't work because I've misspelled the links! Check the links above and you'll see that I've typed wtheme and not wptheme.

And I'm sorry for not replying earlier. The e-mail notification seem to have not worked for me this time.
 
Back
Top