WordPress.org

Ready to get started?Download WordPress

Forums

Same code - different css (8 posts)

  1. pizzaman
    Member
    Posted 8 years ago #

    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.

  2. TechGnome
    Moderator
    Posted 8 years ago #

    Yuuup.... that's the way it works.

    -tg

  3. moshu
    Member
    Posted 8 years ago #

    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.

  4. pizzaman
    Member
    Posted 8 years ago #

    Thanks Moshu.

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

  5. moshu
    Member
    Posted 8 years ago #

    Yes, add that line with the Template.

  6. pizzaman
    Member
    Posted 8 years ago #

    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?"

  7. pizzaman
    Member
    Posted 8 years ago #

    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?

  8. pizzaman
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.