The MU forums have moved to WordPress.org

Conditional stylesheet using IF statement? (4 posts)

  1. tkreucher
    Member
    Posted 16 years ago #

    I installed WPMU for use on our corporate intranet and have been working with the creative guy to get several blogs going for his use.

    Bottom line, his objective is to use the Spotlight theme (which works fine on its own) for all three of his blogs, but he would like to change the color scheme slightly on each one so that they can be easily differentiated.

    First, he made the modifications to the style.css for each and we uploaded the themes to wp-content/themes into folders named spotlight-Red and spotlight-orange. These show up as being available to be enabled, but when I try to enable them from Site Manager => Themes, it just takes me to a blank page. In my Apache logs I see PHP Fatal Errors stating that the Allowed memory size of 8388608 bytes is exhausted. I set a file size limit of 20MB in my PHP.INI file, so I don't think that's the problem? Also, the same blank page appeared when I initially enabled the original Spotlight theme, but it was still listed as available under Presentation => Themes and is working. But the Red and Orange versions will not enable. He's checked the style.css file on these and it appears that everything is in order.

    We thought perhaps it was because it is the same theme and something is just choking. So then we thought perhaps the better answer is to have different style.css files that we can force the theme to call on, depending on which blog is loaded, since they all use the same elements in the spotlight-13 theme folder other than the style.css being modified to display different colors. So he created SpotlightRed-style.css and SpotlightOrange-style.css.

    Questions I have

    1) Given the problem, which solution is best? To try and set up separate theme folders for each color variant of the same theme, or to try and create a conditional IF statement that determines which of three stylesheets is used?

    2) If the IF statement is the way to go, do I just need to modify the header.php file in the theme folder under the style type tag? Any suggestions on that?

    And I would just like to mention, I have spent a great deal of time attempting to research this on my own before posting here, so please don't think that I'm taking the "lazy" way out by asking for assistance here. I really was trying to find a solution for this on my own, but I am hoping to find some guidance from seasoned users here, since I'm struggling a bit with this. Thanks very much for any assistance you can provide. :)

    Cheers,
    Trase

  2. andrea_r
    Moderator
    Posted 16 years ago #

    At the top of each theme variant's style.css, make sure the *title* of the theme is changed as well. It should find them then.

    Esentially, what I think is happening is even though it looks like there are three seperate theme folders, as far as WP is concered they are all the same.

    Eventually, what I would do is to make one theme with three color options and have a theme options page that changes the style sheet. (which we've done before - no conditional if's involved)

  3. tkreucher
    Member
    Posted 16 years ago #

    Thanks so much Andrea, you pointed me in the right direction. Although the Theme Names were different, the Titles were not, so I changed those. Also, the folder names on the server needed to be changed up - I overlooked the fact that he had them named as "spotlight red" instead of "spotlight_red" and that space was a real problem, whoops! :) (A little DUH moment for me, there)

    I do notice that I have the problem that others have posted about: when I enable a theme from Site Adminstrator:Themes, and click the Update Themes button, it results in a blank page. My workaround has been to use the back button and go to Site Administrator:Blogs and edit the particular blog and enable the theme there, then activate it from the Presentation:Themes area. This makes it seem like I am just activating on a per-blog basis, but unless I do the first step and get the blank page, the rest won't work, either, so it must be activating, but just dumping. But I have a workaround! :)

    Thanks again!

  4. andrea_r
    Moderator
    Posted 16 years ago #

    Well, it's good you solved the issues and found a workaround. :) I think if you upgrade, that white page issue will go away.

    A fresh set of eyes is usually all that is involved in solving the problem, but sometimes it just comes down to a really good guess. :D mostly because I can't see what you're actually looking at. :)

About this Topic

  • Started 16 years ago by tkreucher
  • Latest reply from andrea_r