How to change Widget List View to show events by days of the current week?

Home Forums Calendar Products Events Calendar PRO How to change Widget List View to show events by days of the current week?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #963785
    Orlando
    Participant

    Hi Guys, I am currently trying to customise the list-widget.php (don’t worry its in my theme folder!)
    to look like this the layout below,

      Monday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Tuesday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Wednesday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Thursday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Friday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Saturday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm
      Sunday

    • Event Title – 1pm – 3pm
    • Event Title – 4pm – 5:30pm
    • Event Title – 6pm – 8pm

    Here is a manual example of what I have done…

    So far I have been able to change the code to do this

    <h5 class="entry-title summary">
    					<a href="<?php echo esc_url( tribe_get_event_link() ); ?>" rel="bookmark"><?php the_title(); ?></a>, <span class="event-duration">
    					<?php echo tribe_get_start_time(); ?> - <?php echo tribe_get_end_time(); ?>
    				</span>
    				</h5>

    But I need it to loop through each day of the week, and produce it in the format above, and this I am little stumped on.

    Thanks for any tips of possible!

    #963985
    Barry
    Member

    Hi Orlando,

    What if you do something like this:

    • For the first event, figure out which day it’s taking place on and print the “header” for that day
    • For each subsequent iteration, and check to see what the day is and if it has changed, print a fresh “header”
    • Continue until the loop is done

    In terms of actually figuring out if the day has changed, you could do something like this:

    tribe_get_start_date( null, false, 'Y-m-d' )

    That would provide you with the current event’s start date and you could compare it to that of the preceding event and print out the day header or not, as appropriate.

    #964043
    Orlando
    Participant

    Thanks I will give this a go…

    #964141
    Barry
    Member

    Good luck!

    #964143
    Orlando
    Participant

    LOL! im gonna need it!!

    #964392
    Barry
    Member

    🙂

    #967397
    Barry
    Member

    Hi!

    It’s been a while so I’m going to go ahead and close this topic.

    • Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
    • Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context

    Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How to change Widget List View to show events by days of the current week?’ is closed to new replies.