Thanks James,
That’s what I tried, but it didn’t seem to want to generate the .json files when I saved the ACF groups. I’ll give it another [proper] try and see how I get on (I came to ACF forums to make sure I wasn’t chasing a dead end).
My work’s developed our own developer suite and it includes DB query counts, so I’ve been using that to see if there’s any difference; there doesn’t seem to be.
Yep, caching’s my next route now, just thought I’d dig into the code and see if I could alleviate some of the load!
pecnet,
The way I’ve done it before is as follows. It seems a little long-winded at first, but tends to produce the best (consistent) results.
Create a repeater field: opening_hours
. You make it so each ‘row’ has:
- ‘Day’ (dropdown…Mon-Sun)
- ‘Open’ (text)
- ‘Close’ (text)
Then I make my own WordPress shortcode that loops through the repeater field to output the information in the format I want (HTML, relevant classes…etc.). This negates your requirement for loads of specifically named data (eg. hour_sunday
).