Published on Mar 24, 2020

Countdown Timer using ACF in Oxygen

Sridhar Katakam

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").

ACF Options page
Countdown timer on the front 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();
}

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 3

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 $499 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right