WordPress.org

Support

Support » How-To and Troubleshooting » Same code – different css

Same code – different css

  • Can’t seem to find a how-to on this.

    I have 4 themes. All use the exact same php files but different css. How would I set up WP to use the same code with 4 different css files?

    As it stands now, every time I make a code change I have to upload 4 files – one in each theme’s dir.

Viewing 7 replies - 1 through 7 (of 7 total)
  • TechGnome

    @techgnome

    Moderator

    Yuuup…. that’s the way it works.

    -tg

    That’s easy.
    Keep one as the “main” theme and delete all the files except the style.css from the other 3. (Of course, if they have different images in an image folder and referred to from the stylesheet, keep the images, too!)
    Let’s say, the main theme will be called “alpha”.
    At the top of the remaining 3 stylesheets put this:
    /*
    Template: alpha
    Theme Name: The Second Variant
    Description: whatever
    Author: your... etc.

    and the Third and the Fourth and so on.

    Thanks Moshu.

    Is it the header in the stylesheet that makes this work?
    Currently I have “Theme Name” and the rest but no “Template”.

    Yes, add that line with the Template.

    Finally got a chance to try the above.

    The “main” theme and one other show up in admin. Admin says that the other two are “installed but incomplete. All themes must have a template.”

    Here’s what I have:

    Main theme css header:
    /*
    Theme Name: Main Theme
    Description: Blah…
    etc..

    2nd theme css header:
    /*
    Template: Main Name
    Theme Name: Name #1
    Description: Blah…
    etc…

    3rd theme css header:
    /*
    Template: Main Name
    Theme Name: Name #2
    Description: Blah…
    etc…

    4th theme css header:
    /*
    Template: Main Name
    Theme Name: Name #3
    Description: Blah…
    etc…

    Does the Theme Name line HAVE to say “The Second Variant?”

    Wait. I left a colon out of the one other theme that was showing up. Now all three of the “template” theme are marked as broken. Admin says that they must have a stylesheet and a template. I’m confused. Could it be because I haven’t deleted all the php files from the other three dirs?

    Got it all figured out – finally.

    The child theme must have the name of the parent theme’s directory in the “Template: xxxx” part of the css header.
    I was using the parent theme’s name.

    Thanks again moshu for pointing me in the right direction.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Same code – different css’ is closed to new replies.
Skip to toolbar