Home › Forums › Calendar Products › Events Calendar PRO › Weekly events shortcode: Hide days with 'No events'?
- This topic has 6 replies, 3 voices, and was last updated 9 years, 3 months ago by
Jeff Brown.
-
AuthorPosts
-
December 25, 2016 at 9:57 pm #1210531
Jeff Brown
ParticipantUsing 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
December 27, 2016 at 7:13 pm #1210927Nico
MemberHi 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,
NicoDecember 27, 2016 at 10:44 pm #1210949Jeff Brown
ParticipantI 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
December 28, 2016 at 10:21 am #1211145Nico
MemberThanks 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,
NicoDecember 28, 2016 at 7:55 pm #1211256Jeff Brown
ParticipantAh, I see –wrap the whole thing in a conditional.
Thanks!
December 29, 2016 at 8:43 am #1211420 -
AuthorPosts
- The topic ‘Weekly events shortcode: Hide days with 'No events'?’ is closed to new replies.
