feature request: function to use in template and style switcher

Would be great if this plugin has a template function so I could use it with a theme's templates without requiring the widget to be used. Something like:

<?php
theme_switcher('dropdown');
?>
where dropdown would be how you would like it displayed.

Also the ability to choose a stylesheet for a theme:

?theme-preview=SomeTheme&theme-style=red

  • Paul
    • The Green Incsub

    Actually some followup. You can already use a template function. Just add the following to your theme where you want the theme switcher:

    <?php
    global $advanced_theme_switcher;

    // The function accepts one parameter 'text' (default) or 'dropdown'
    echo $advanced_theme_switcher->theme_switcher_markup('dropdown');
    ?>

  • Steven
    • Site Builder, Child of Zeus

    Not really, but I've seen some examples around the place like woothemes
    http://demo2.woothemes.com/?name=drawar

    I assume they work by monitoring the theme's folder for .css files and adds them into a dropdown list. When a style is selected, red.css for example, it would replace the main style.css with red.css and set a cookie.

    Would be really handy, because instead of loading a whole new theme, you could have one theme, but load another css file that alters the layout and colours drastically.

  • Paul
    • The Green Incsub

    Andrew, I've checked our own Themes here on WPMUDev and don't see any like that. I know what you are saying and I've seen these as well. Did a quick search and I only came across a few themes for mobile. On each the color option is implemented as a child theme. So in that case the existing theme switcher logic holds.

    I'l going to close this thread since there is an existing template function you can use. I think any extension of this logic to support specific stylesheet would be specific to how the theme is developed any would fall outside of the theme switcher plugin.

  • Steven
    • Site Builder, Child of Zeus

    Ok appreciate for the update. It seems a bit counter productive to create a whole new child theme just for a new colour scheme. With the Genesis Framework, you just create a new stylesheet, drop it in the theme folder, and then you can change the theme from a dropdown on the theme options page.

    Found an example of another theme switcher that allows you to choose a stylesheet, however I would like to completely replace the stylesheet, not just load more.

    http://wordpress.org/extend/plugins/wordpress-theme-demo-bar/

    To load extra css, simply add a variable "extracss" to your site URL and seperate using comma. For example: myblog.com/?themedemo=mytheme&extracss=blue,twocolumn this loads blue.css and twocolumn.css from the theme's directory

    Got a sneaky feeling I need to look into add_filter(get_stylesheet, $function)

    Thanks anyway!

  • Paul
    • The Green Incsub

    Andrew, Sorry for the delay. I did find a few themes in our own WPMUDev site theme packs using selectable stylesheets. So will be focusing on that integration first. But as I suspect this may not be a universal solution. I'll keep you posted on a solution.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.