Weekly events shortcode: Hide days with 'No events'?

Home Forums Calendar Products Events Calendar PRO Weekly events shortcode: Hide days with 'No events'?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1210531
    Jeff Brown
    Participant

    Using the shortcode described here is working well for me –https://theeventscalendar.com/knowledgebase/configuring-the-this-week-widget/

    However, I don’t want to see days/dates that don’t have any events. Simple having Wednesday and friday appear with those days events would be great.

    I could do a bit of jquery to find <div.tribe-this-week-widget-day> that contains the text ‘No Events Today’, add a class, and apply {display: none} or just remove the element, but that seems kind of cumbersome, and people would see blips of the empty days on page load.

    Is there are better way to do this?

    Thanks

    #1210927
    Nico
    Member

    Hi there @opus13,

    Thanks getting in touch with us!

    It’s a pretty clever idea the one you propose, but as you say might not be the best. I think it’s probably better to edit the template that renders each day of the week in the widget and alter the output for the days without events. This template is located at events-calendar-pro/src/views/pro/widgets/this-week/loop-grid-day.php, you can create a template override of this file by following the instructions outlined in our themer’s guide. I think you’ll get right away how to alter the template to work for your needs when you inspect the actual code but please don’t hesitate to let me know if you are not sure about it.

    Best,
    Nico

    #1210949
    Jeff Brown
    Participant

    I have only rudimentary skills with PHP :/

    Looking at that file you pointed at I only see the outputs for each day of the week, but not a way to remove the parent element of <.this-week-no-events-msg>

    Thanks

    #1211145
    Nico
    Member

    Thanks for following up!

    To remove ‘all the day’, just add this code to line 15 of the template override:

    <?php if ( $day['has_events'] ) : ?>

    and after the last line of the file add:

    <?php endif; ?>

    This should remove all the day if it doesn’t have events. Can you please confirm this is what you were looking for?

    Best,
    Nico

    #1211256
    Jeff Brown
    Participant

    Ah, I see –wrap the whole thing in a conditional.

    Thanks!

    #1211420
    Nico
    Member

    Thanks for following up @opus13!

    Ah, I see –wrap the whole thing in a conditional.

    Yeah! That’s the idea 😉

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Weekly events shortcode: Hide days with 'No events'?’ is closed to new replies.