I've made my first theme and now I want to create different "profiles". These profiles are just independent CSS files that user can try. The point is, how to make these files to allow users to choose the color scheme through the admin panel? It is, I don't want to allow users to access to the file system, so they will have to change the CSS file using the admin panel. How to do it? Is there any plugin that allows to change CSS files?

  • 2
    Are you aware of theme options? First get used to theme options and wp_enqueue_style. Alternatively you can define all the styles in one css file with classes as red, green etc., and depending on the theme options, set the appropriate classes wherever you want the color specific styles. – Rutwick Gangurde Dec 21 '11 at 18:19
  • Do you want users to be able to change the CSS literally or are you asking how to allow users to choose from a defined list of stylesheets, it's not clear from your question what you want to allow users to do. – t31os Dec 21 '11 at 21:36

This article should answer your question:

Add a style switcher to your wordpress theme

The article that I have linked above explains and walks you through on how to add a stylesheet switcher to your admin panel for your theme.

It walks you through on how to use and add options to your theme. This is particularly intuitive if your developing a theme for a client who once in a while may want to change their colors / imagery or something on a whim.

I have used this numerous times when theme developing. Also in using this method you can add as many stylesheets as your heart desires.

| improve this answer | |
  • Here is a link to an example, go read it, doesn't really make for a good answer and is also my reason for down voting it. If you want to work at improving your answer i'll be happy to switch to an upvote. – t31os Dec 21 '11 at 21:40
  • Sorry @t31os I was kind of in a hurry and did not have time to expound on my answer. I edited it above. – Nicole Dec 22 '11 at 2:21

You can setup some settings within your backend to have the user choose which stylesheet they want and on init, check the value and depending on the value of that setting, enqueue different stylesheets.

| improve this answer | |
  • 2
    If you're going to suggest a way to tackle a problem(and honestly this is a pretty simple one), please show how to apply the solution you're suggesting. I've down voted the answer on those grounds, as with Nicole, i'll switch that for an upvote if you work to improve your answer. – t31os Dec 21 '11 at 21:44

You could also create child themes that differ only in their CSS, and let the user change between them using the same method for changing themes.

The up side of this is that the theme switching screen shows screen shots of the theme, so the user can tell what their site will look like after changing the CSS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.