This repository contains WordPress theme files which provide an example of how to update an ACF database field via AJAX. And to automatically refresh the current field value every 5 seconds.
- Version:
1.0.0 - Author: Ryan Fitton
- Author URL: https://ryanfitton.co.uk
- Ensure you have WordPress installed. Tested from WordPress 5.3.2
- Install ACF Pro (Pro required for custom options page)
- Upload the ACF export file
acf-export-2020-03-31.jsoninto your ACF settings
tmpl_page_ajax.php- Page templatefunctions.php- Functions for Ajax callsajax.js- JS Ajax callslibs/js.cookie.min.js- Used to set Cookieslibs/rsvp.min.js- Allows Promise JS to be supported in IE11
You may already have a functions.php file in your theme, if so; do NOT overwrite this repo's file with your existing file.
Instead, copy and paste the contents of this repo's file, to the bottom of your existing theme file.