Support » Themes and Templates » Theme Switcher or Style Switcher

  • If I want to create a second style sheet for a theme, where the structure is exactly the same but things like the header image and colours are different, would I use a style switcher or themeswitcher?

    I simply want the user to click an icon which represents the stylesheet – they click the icon, and the theme changes and keeps the chosen stylesheet design.

    Is it simple to do this? Not just implementing the style switcher, but the process for having three or four differnet colour styles that change on click by the user, and the actual creation and implementation of another colour scheme?

    Thanks in advance

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi Jinsan,
    You ask whether what you need is “a style switcher or themeswitcher.” I’m not sure that there is really a difference, given that the file in which a theme is defined is style.css. So if you switch files, you switch themes at the same time. At least, that’s the way it seems to me.

    I just asked a rather similar question in a different way. See the topic about metathemes, or families of themes, or the more detailed post:


    ah see this is where I don’t think that’s strictly true – my understanding is that a theme is a theme if it contains x, y and z template files AND a style.css – I think this was the distinction between styles for 1.2 and themes for 1.5. Which is why I asked. With the styleswitcher all it did was switch the css file, with the themeswitcher, if I’m not mistaken, it will look for alternative templates? I;m not sure if only switches the stylesheet – but I think I just read a few moments ago during a search that styleswitcher doesn’t actually work in 1.5. So it will have to be themeswitcher, I just wonder HOW it works.

    Oh well

    You could use either one really. Just copy and paste all the same files into a new folder and use the different CSS file. Or you could set it up to display different style sheets. Either one would work really.

    A theme can be a minimum of a stylesheet only. The themeswitcher switches the style sheet. That calls the template (in this case the same one). So one theme and multiple styles. Which IMHO is where we should all be headed.

    Like previously mentioned, you can just use the same templates for each theme, with a few changes. I use basically the same header, footer, sidebar, and index files for my themes and just change the header image.

    @lawtai and Spirit892: Your suggestions are sound, but create separate and distinct themes, unless I am misreading. In other words, one does not need one theme, for the other to function. I think Jinsan is wanting to have the subthemes relating to the same layout all contained in one file/directory. I want to do the same thing with the theme I am currently working on. Its not as easy as would first appear.

    Actaully, you would technically be creating a separate theme, but it would have the exact same files as the “theme” that you do want. So in reality, everything’s the same, other than the style.css file. The structure would be exactly the same because you’d be using the exact same files. Colors could be different because you’d be using a different CSS file.

    So it would allow for “subthemes” but just involve storing more files on your server.

    I know what you are saying… either way, the theme requires more files.. I am porting over a theme from Pivot, which has all the theme files contained within its own structure. the theme is called Slick, and it has subthemes according to colour, there are 6 of them altogether.

    The structure of the theme directory is thus: it contains all the files required for layout, and all the separate css files. one css file is for the base elements relating to *all* the subthemes including the default.. so for us, thats style.css. It also contains css files named according to colour, eg graphite.css and of course these are named in the “head” elements of the header. In the images subdirectory there are all the graphic elements of the default theme. There are also subfolders here, containing the graphic elements for all themes including the default.

    The problem for me is how to switch out the specific css *and* the graphic elements for each subtheme, on demand, so that WP can see them.

    Or…create a separate theme which would be the easiest option, but not in the spirit of the original Pivot theme

    well, there was a style switcher for 1.2, which I believe still works for 1.5 (not sure on this since I haven’t used it) but it required you to create many subfolders. Check Alex King’s site as I believe he was the one who came up with it for 1.2.

    Thanks, I’ll look into it, because Marco’s .js switcher is not going to work for WP, I think.

    he updated it for 1.5 so it should work. also, the pivot theme is nice, any chance you’ll be releasing it?

    I will release it, when I get it right. All my fiddling in the last couple of hours has managed to completely break the layout, so I need to take a rest and do some other things. Get outside, ya know… And come back with a fresh outlook which may help me see what I am doing wrong.. I have now managed to get the content and both sidebars all left aligned… without changing anything useful that I am really aware of. Gotta go rest my eyes and brain.

    Looked at the style switcher. Again, because its a plugin and has certain expectations of where files are supposed to be, is unlikely to work.

    There must be a solution within the javascript, I think pursuing that option is going to be more fruitful.

    But first, I have to clean up the mess. Tomorrow.

    kyte you are making a mountain out of a molehill. Use the theme switcher. And the correct file path for the images. The tag is in the Codex.

    As I just noted in “my” related thread, this seems to be exactly what this line in the theme’s style.css is for:
    Template: use-this-to-define-a-parent-theme–optional
    Check it out in the Codex, and see if it does what you want. I think that it will, and pretty simply too.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Theme Switcher or Style Switcher’ is closed to new replies.