Floating Theme Switcher

Floating Theme Switcher

Floating Theme Switcher allows visitors to change the theme they use to view your site.

This plugin is designed specifically for theme demo sites by making the theme switcher more obvious (and obviously separate) than those that output a list of choices in the theme’s sidebar.

Download →

Floating Theme Switcher is closely based on Themebot’s Theme Switcher Reloaded. I just wanted to use the code in a slightly different way.

  • Make the theme switcher more obviously separate from the theme by sticking it at the top of the page.
  • Include the theme switcher code automatically, so no need to modify your themes to include the sidebar code snippet / enable widgets.

Essentially I wanted to divorce the theme switcher more from the theme, both visually and in code. You can see it in action on the theme demo site.

The old ways of switching themes supported by Themebot’s Theme Switcher Reloaded and Ryan Boran’s Theme Switcher (via widgets or sticking code in the sidebar) should still work, though the styling may possibly be a little off. That said, if you don’t want the look or functionality provided by this version, I’d suggest using the original. :)

This plugin uses a rather nice icon from IconTexto. You can find the whole set here.

Installing the plugin

  • Upload the floating-theme-switcher and (optionally) just-jquery folders in the zip file to your plugins folder (probably /wordpress/wp-content/plugins).
  • In your WP admin panel, activate the Floating Theme Switcher and Just jQuery plugins.

JavaScript magic

This plugin uses the wonderful jQuery to sprinkle a little magic pixie here and there. It works fine without jQuery, but looks neater with it. Quite a few WordPress plugins use jQuery or other JavaScript libraries, and unfortunately they can interfere with each other with sometimes hard-to-diagnose results.

In an effort to reduce confusion and library duplication somewhat, Floating Theme Switcher does not include jQuery itself. The plugin download contains another small plugin called Just jQuery that you can use to add jQuery to your site if you don’t have a copy already. There’s more info about it on the Just jQuery page.

It doesn’t work!

Can I create a direct link to one of the themes?
Yes. Just select the theme you want with the theme switcher and copy the URL. (If it’s the default one, change the theme and switch back.) The URL will have a suffix that signifies your chosen theme, so

http://www.poleexercise.co.uk/demo/index.php?wptheme=Juicy

links directly to the Juicy theme on this site. (This functionality is supported by other versions of the plugin too.)

The theme switcher looks funny when I select one of my themes.
Your theme’s styling is overriding one of the theme switcher’s styles. I’ve tried to prevent this from happening, but I may have missed something. Please send me a link to the problem page and I’ll try to sort it out.

Your theme switcher is changing the look of my theme!
I’ve made the styling as specific in scope as I can to try and stop this from happening. (You may wish to ask yourself at this point why giving a div the class FloatingThemeSwitcher seemed like a good idea…) Again, please send a link and I’ll take a look. Thanks.

The whizzy up down animation doesn’t work / doesn’t work any more.
You need jQuery for this. (You also need JavaScript enabled in your browser of course.) Please check that you have activated the Just jQuery plugin. If you’re still having problems then something else may be interfering with jQuery. This can be tricky to diagnose; there’s a lot more information on the Just jQuery page that will hopefully help you sort it out.

The theme switcher doesn’t show up at all with some themes.
The plugin relies on a WordPress hook to insert its code into the footer. If the theme has been badly written and missed out this call then it won’t show up. It’s easy to remedy, though. Open the theme’s footer.php file and add the line <?php wp_footer(); ?> just before the </body> tag. Save, upload again and you’re done.

0 comments

  • No comments yet… Why not kick things off by filling out the form below?

Leave a Comment