Supposing you have a couple of different email lists that you want to rotate out by the month, week or year. It would be rather tiresome to have to manually change it out each time. While you can hire these out, it’s more economical in the long run to let technology do it. Especially when these are the perfect things to be automated.
How do you get it done? That largely depends on what you are using to publish your website. Since I am a WordPress fan, the following instructions are MFWP (made for WordPress)
First of all, to clear up confusion and followup questions. Everything we are doing will go into your theme’s functions.php file. If you switch themes, you will lose this feature, but don’t worry. You can easily copy and paste the code over to your new theme’s functions.php.
Determine Your Times
In a real scenario, you would already know how often you’d like to rotate or switch out your forms. Everything in this tutorial is dependent on this. The easiest is to go by hard dates and because of that and for brevity’s sake, we are going to develop this based on month.
Paste This Code
Copy and paste this code into your functions.php file
Replace Your Form Code
Now comes the hard work. Paste your different subscription form codes for each month in the spot where it says “Paste form code here“. Notice at the end, there is a default option. I suggest you enter a form that you want to use if you don’t know what the month is. This is unlikely to happen but it’s always a good thing to have a fallback incase of hiccups.
Add Your Shortcode
Now, where you want the subscription form to appear, simply enter this shortcode [rotatingforms]. Now, each month that passes by, the form will be rotated out automatically and perpetually. Neat huh?
Here’s something to think about. Just because this is written for a subscription form doesn’t mean you have to enter a form. As you can see I have a header with month names for each month. You can actually enter any HTML code in between the <?php and ?> tags. That should give you some ideas how to re-use this code and if you find some creative uses, let me know I’d love to hear about it.
FYI, this code is written and tested in WordPress 3.6.