This members-only tutorial provides the steps to set up a countdown timer in Oxygen with the value coming from a Date Time Picker type of custom field on an Options page instead of hardcoding the value (like "Nov 23, 2028 00:00:00").
Update: Changes for a calendar-styled countdown are provided at the end.
Step 1
Install and activate ACF Pro and Code Snippets plugins.
Step 2
Let us enable an ACF Options page.
Go to Snippets > Add New.
Title: Enable ACF Options Page
Code:
if ( function_exists( 'acf_add_options_page' ) ) {
acf_add_options_page();
}
Set the snippet to run only in the admin area.
Step 3
Go to Custom Fields > Add New.
Create a field group titled say, "Sitewide" having a Date Time Picker-type of custom field with the name of countdown_date
. Set it to appear on the Options Page.
Set Display Format and Return Format to F j, Y H:i:s
.
Step 4
Click Options in the WP admin and pick your desired countdown date.
Step 5
Install and activate My Custom Functionality plugin.
Connect to your hosting account using a FTP client and navigate to site's /wp-content/plugins/my-custom-functionality-master
.
Create a file named say, countdown-date.js
in the plugin's assets/js
directory having the following code:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.