1

I have been trying to come up with a good way to switch between summer and winter content. I am building a rental site and when the customer books they are automatically redirected to a second page with options to add other products to the cart.

I want to have two buttons probably at the top of the site, title summer and winter. When these are clicked the background image would change to a summer one, and maybe change some of the css. But most importantly the product redirects would change.

My initial thoughts were a theme switcher, then have a winter and summer theme. With separate menus and separate page templates, this would also cover the css option. Unofrtunately other than theme switcher reloaded(which doesn't seem to work)I have not come across anything with this kind of functionality.

So my question is, can anyone suggest any other ways that I might go about this kind of funcionality, or any tutorials or hints and tips on how to build this myself?

Right here is a list of my research:

I have experimented with the Themes Switcher Reloaded plugin, which is deprecated but was easily fixed. The issue with a theme switcher is that most content is shared accross the themes, so I could use page templates, but I think that could get a bit messy.Also the themses i'm switching between share menu's so I can't have an alternate menu for summer/winter.

I can't use a multisite, because I have a shop and woocommerce doesn't share its database accross the multisite.

I have now had a look at the daylight savings plugin idea by Kaiser, which will be great for css, but I also need to be able to change what product category templates are called.

I hope this makes sense and helps.

All the best

Harry

2
  • For future questions, please read How to Ask. I'm not closing this off, but: Sharing your research helps everyone. Tell us what you found and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer. More info about how to ask a good question can be found on the How to Ask page. Keep in mind that recommendations of any kind are off topic on all StackExchange sites aside from Software recommendations.
    – kaiser
    Feb 24, 2015 at 7:37
  • 1
    And thanks for this Kaiser, I thought I had been quite thorough but now reading through the how to ask section I see what you mean about research. I'll amend this soon.
    – Harry Rook
    Feb 25, 2015 at 10:43

1 Answer 1

0

Probably the easiest thing to use is the date() function with the "daylight savings argument and add a custom <body> class:

<?php
/** Plugin Name: (#179112) Daylight savings body class */
add_filter( 'body_class', 'daylightsavings_classes' );
function daylightsavings_classes( Array $classes )
{
    $classes[] = 0 === date('I') ? 'winter' : 'summer';
    return $classes;
}

This plugin appends either winter or summer to your classes. Therefore it allows you to use different rules in your stylesheet and style your elements accordingly.

3
  • Nice this could be great, i'll look into it
    – Harry Rook
    Feb 25, 2015 at 10:38
  • Wait, I just thought. Tell me if this is a silly idea. But Could I using the the code above. Wrap all pages in both classes and on one stylesheet have all winter classes set to display: none; and vice versa?
    – Harry Rook
    Feb 26, 2015 at 14:07
  • Your body element will have either one or the other class. You can still add a conditional if ( is_singular() ) or similar check inside above mu-plugin to only add them to specific types of templates. About your actual question: That highly depends on what you are going to do and how your setup & stylesheets are structured. I can't make any recommendation there.
    – kaiser
    Feb 26, 2015 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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