Hiding time and date sensitive information from WordPress posts and pages

Clock with time blocksIt’s not often that I recommend a plug-in which isn’t found in the WordPress repository, but this one is so cool, and has saved me so much time and stress I just had to share it.

This one is called Before And After, and you’ll find the download here
by clicking the little silver arrow at the bottom of the description. The site is in Dutch, so you may want to use a translator to see it.

Basically, this plug-in lets you add some hidden code to your pages and posts which determines when text should be shown.

After you’ve installed and activated the plug-in, in your Dashboard, under Settings > General ensure your site is set to the correct time zone. We’ve set ours to Toronto, so it knows to update for daylight savings time automatically.

Then you can start using the codes by putting them around text in any page or blog post.

This code will show the text BEFORE the date and time you’ve entered:

<BEFORE YYYY-MM-DD MM:SS>You’ll put in here what should appear on the site before the date/time you specify.</BEFORE>

This code will show it AFTER:

<AFTER YYYY-MM-DD MM:SS>You’ll put in here what should appear on the site after the date/time you specify.</AFTER>

If you just have a single date when it should be shown, use this code:

<SINGLE YYYY-MM-DD>You’ll put in here what should appear on the date you’ve chosen.</SINGLE>

You’ll want to replace the letters above with the date and time, ensuring you use the full year, month, day – like 2014-04-01. The time uses the 24 hour clock, so it will be 00:00 to 23:59. You’ll also need to be in Text mode for this work, and if you switch into Visual, you’ll have to add the codes back in again, so best to get everything looking the way you want on the page, and add these as the final step.

Then combine them all together for even better effect.

What a perfect way to show the lead-up to a sale:

<BEFORE 2014-04-01 00:00>Check back here on April Fools’ day to see our special offer</BEFORE>

The day of the sale you could show all the details:

<SINGLE 2014-04-01>Here is our special April Fools’ Day sale</SINGLE>

And the day after, change it to something like

<AFTER 2014-04-01 23:59>Sorry, you’ve missed our special, but check back soon, we’ll have more!</AFTER>

Since this can all be done automatically, and in advance, you won’t have to work frantically making changes to the offering while the clock ticks ominously in the background (queue the Jeopardy music).

One caution – this plug-in uses the same name as one which is in the WordPress repository, so it will tell you an update is available, but this is a completely different plug-in. DON’T UPDATE or your dated posts won’t work properly.

Any other ideas for how to best make use of this plugin? Let us know in the comments. If you need help adding something like this to your site, give AWEBthatWORKS a call – 1-800-579-9253.

Comments Off on Hiding time and date sensitive information from WordPress posts and pages
Posted on by Sue
Categories: WordPress
Tags: ,