Support

Account

Home Forums General Issues opening time for store, an idea?

Solving

opening time for store, an idea?

  • Hello,

    I use the ACF plugins for my site

    I have a category “Store”

    I added in a place in the store category

    Name
    Address
    Phone
    Web
    E-mail

    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.
    Sunday: Close

    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

  • Hi @pecnet

    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?

  • Hello,

    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 …

    A condition

    Show hours of shops

    If I click yes

    it displays the days already record, just for me just add hours

    If not

    nothing to do

    Because

    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; ?>
    

    thank you

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

  • 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?

    Thank you

  • Hello,
    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

    https://www.youtube.com/watch?v=uNoS7B20LsI

    Thank you

  • Good evening,
    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; ?>  
    
    
Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘opening time for store, an idea?’ is closed to new replies.