I want to dynamically show the opening hours of today’s weekday.
I’ve created a CPT ‘Traders’ for which I want to have an ACF-field with its opening hours throughout the week. What I then want is only show the opening hours of that weekday, that if wanted folds out into the full opening hours.
Would anyone know how to do this?
There are several ways you can do this. Here are a couple of ideas:
Using individual fields
A possible solution is to create a separate field for each weekday that is a simple text input field for the time period.
You can then load each weekday’s times into individual blocks inside the page/template and then use date based visibility conditions to show/hide them.
Using a repeater
Another possible solution is to use a repeater field containing a weekday selection field and a start time and end time field.
This would require adding some custom code to show/hide the correct weekdays because currently Cwicly doesn’t allow loading of selected repeater items:
Currently it is only possible to load all repeater items, we would like to be able to load individual items or a range of items.
This will be very useful for cases where you use a repeater to allow a client to more easily manage grouped indexed/ordered content within a post but still want to be able to display that content as individual items within a template.
This is the current UI:
[Screenshot 2023-04-12 at 13.51.47]
thank you so much! it worked for me, amazing