You don’t have to be an expert to publish a WordPress post. Everything’s quite easy to understand from the start, and you can have your first article published in a matter of seconds after the installation of WordPress. If you take a look at the widgets on the right side of your editor, you will find that it’s also quite simple to schedule a post for any date and time in the future. Changing post status and visibility is in a reach of a mouse pointer, but what about showing only parts of the content on specific dates?
Unfortunately, WordPress doesn’t have the function available by default. But don’t worry; you won’t have to code things manually since there are already plugins available for the job.
In today’s article, let us show you a very simple plugin which will allow you to show customized content on specific dates.
WP Chrono is a relatively new and unknown WordPress plugin. There are only about 40 active installations at the moment, but we’re sure that the number will increase in the future. The plugin is very simple; once you install and activate it, there are literally no settings you should worry about. So, don’t look around for the options page in the WordPress menu – everything you need is hidden in several shortcodes provided by the plugin. In the following lines, we will show you how to use them.
WP Chrono allows you to display current date and time, show customized content on specific dates and date ranges, and show a simple countdown timer.
Display current date and time
If you just want to show date and time in your post, page, or actually anywhere on the site, you can do it with a simple shortcode created by WP Chrono. Let’s take a look at several examples of how to use the shortcode:
- Date: [wpch-currentdate] – output: February 11th, 2017
- Time: [wpch-currentdate format=”g:i a”] – output: 12:21 pm
- Date and time: [wpch-currentdate format=”F j, Y g:i a”] – output: March 18, 2017 10:44 pm
Since the plugin uses PHP date/time function, you can easily customize the output to your likings. We suggest that you take a look at all the date/time function parameters so that you can customize your output easily. Try out a few options until you get the output you really like.
Did you know that you can also quickly show relative dates next to your post and comment dates?
Display customized content on a specific date/time
Just showing the date and time isn’t that fun, right? So, the real fun with the plugin begins here where you get to show customized content on a specific date and time. WP Chrono even lets you set simple conditionals which will control the content.
For example, you can set to show a particular content just on Christmas, while showing something else on all the other dates.
[wpch-ifdate date="2017/12/25"]This is the content that will be printed only on 25th December 2017. [else]This is the content that will be printed on all the other dates. [/wpch-ifdate]
When we say content, we don’t talk just about text. You can have anything you want in between the shortcodes. So, you can show images, videos, coupons, code, and actually anything you want. The shortcode allows you to update your posts and pages now, and forget about updating the article on specific dates. How amazing is that?
Specify starting and ending dates
While the previously mentioned shortcode controls the content for the specific dates, the following one can control the content for a date range. If you have the starting and ending date for the content, you can use it with this shortcode:
[wpch-ifdaterange fromdate="2017/02/11" todate="2017/03/11" ]This is the content that will be displayed for a month; starting on 11th Februaray 2017 and ending on 11th March 2017 [else]This content will be shown on all the other dates. [/wpch-ifdaterange]
Here’s a great example from the official site on how to combine the previous two shortcodes and show promo codes on specific days, for a given period:
[wpch-ifdaterange fromdate="2017/02/11" todate="2017/05/17"] This copy will be printed if the range is between 2017/02/11 and 2017/05/17. Show different promo codes for each day within the range we specified: [wpch-ifdate date="2017/03/20"]Promo code for today is: MyPromoCode-001[/wpch-ifdate] [wpch-ifdate date="2017/03/21"]Promo code for today is: MyPromoCode-002[/wpch-ifdate] [wpch-ifdate date="2017/03/22"]Promo code for today is: MyPromoCode-003[/wpch-ifdate] [wpch-ifdate date="2017/04/23"]Promo code for today is: MyPromoCode-004[/wpch-ifdate] [wpch-ifdate date="2017/04/24"]Promo code for today is: MyPromoCode-005[/wpch-ifdate] [else] This is the content shown for all the dates outside the specified range. [/wpch-ifdaterange]
Create a CountDown timer and show any content after the time runs out
If you want to announce something, there is a last shortcode on the list which will allow you to create a countdown timer. You can hide the content in the timer and show it only after the time runs out. Here’s how to use the shortcode:
[wpch-countdowntimer name="first" date="2017-03-12 11:23 PM" template="darkblue"] This is the hidden content which will be displayed after the time runs out. [/wpch-countdowntimer]
The timer supports templates (dark blue, blue, dark purple, purple, green, red, yellow) and you can even create your own ones by customizing the CSS. Unfortunately, since the content is hidden via CSS, it will be viewable in the code. So, for example, if a user opens a console in a browser, it will be easy to see the “hidden” content just by opening the right element. It can be fun to use the timer, but if you’re planning on hiding something important, you should avoid this option.
We hope that the developer will update the plugin shortly and provide a way of actually hiding the content.
Since there are more and more people who need to show customized content on specific dates, we think that the plugin will find its audience quickly. We hope to see even more features in the future, and we hope that the developers will include a simple user interface to make the shortcodes a bit easier to use. How do you like WP Chrono?