Home › Forums › General Issues › opening time for store, an idea?
I use the ACF plugins for my site
I have a category “Store”
I added in a place in the store category
And I would add the way to display the store opening time
Monday: 8:00 to 4:00 p.m.
Sunday: 8:00 to 4:00 p.m.
Mecredi: 8:00 a.m. to 4:00 p.m.
Saturday: 8:00 to 4:00 p.m.
Friday: 8:00 to 4:00 p.m.
Sunday: 10:00 to 2:00 p.m.
can you tell me how I can make this work “automatically if possible”
an idea or a way to do it?
thank you very much
I’m not sure what you’re asking..
Do you want to know how to add your stores open times in admin AND how to displays todays open hours on your front end or just how to display todays open hours on front end?
ACF I know, I already use
I know customize display fields on my template,
until the no worries.
I just try to find a logic to display hours for stores.
Automatic template or I simply between the hours, the days are already present in the back office …
Show hours of shops
If I click yes
it displays the days already record, just for me just add hours
nothing to do
I can see like that,
but I try to see if we can help it and just
<?php if( get_field('hour_monday') ): ?> Monday: <?php the_field('hour_monday'); ?> <?php endif; ?> <?php if( get_field('hour_sunday') ): ?> Sunday: <?php the_field('hour_sunday'); ?> <?php endif; ?>
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:
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.
OK if I want to use fields that repeat,
I have to take ACF pro?
it is possible to have a screenshot of what you explain above for a better understanding?
I am almost at my goal.
I use the conditions and it works well, and I also use date and time picker to set the time.
But I wonder if I can determine for one day
the beginning and end of the opening
Example Monday xx: xx to xx: xx on the same fields personalize
here is a video of my test
as I said yesterday I have a track but I do not know if this is the best way,
Here are the source code
<?php if( get_field('opening_hours') ): ?> <div class="news-v3 margin-bottom-60"> <div class="news-v3-in"> <h2>Opening hours</h2> <br><br/> <p> Monday: <?php the_field('monday'); ?> <br/> Tuesday: <?php the_field('tuesday'); ?> <br/> Wednesday: <?php the_field('wednesday'); ?> <br/> Thursday: <?php the_field('thursday'); ?> <br/> Friday: <?php the_field('friday'); ?> <br/> Saturday: <?php the_field('saturday'); ?> <br/> Sunday: <?php the_field('sunday'); ?> <br/> </p> </div> </div> <?php endif; ?>
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.