Home › Forums › Calendar Products › Events Calendar PRO › Changes to list widget
- This topic has 13 replies, 3 voices, and was last updated 11 years, 9 months ago by
Casey.
-
AuthorPosts
-
June 18, 2014 at 10:40 am #233427
theukedge
ParticipantI made some customisations to the list widget, which I believe was broken by the changes brought about in 3.6.
What I’m trying to do is only show events that are marked as “Featured”, which is a custom field (checkbox) that I added through the Additional Fields section of the settings page. What is the best way to do this?
And where should the revised widget template go? I’m confused whether it should be in /theme/tribe-events/widgets/list-widget.php, or /theme/tribe-events/pro/widgets/list-widget.php
June 18, 2014 at 1:34 pm #233732gerryleblanc
ParticipantI’d like to tag on to this thread… I also made some custom edits to the list widget to show venue information, and it now no longer works with the 3.6.1 update. I am not running the Pro version. I was using some code I took from the single-event.php file that “Setup an array of venue details for use later in the template” and that no longer does the trick. Can the tri.be folks shed some light?
June 18, 2014 at 1:35 pm #233736Casey
Participanttheukedge,
Thanks for getting in touch! We definitely made some changes to our list widget template in version 3.6 (you can read more here). As such, you’ll need to update your template overrides from the 3.6 version and fit in your customizations after that.You’ll want to be overriding the PRO list widget like this: ‘YOUR_THEME_DIR/tribe-events/widgets/list-widget.php’. Take a look at our themer’s guide for more information about overriding template files.
Give those suggestions a try and let me know if you need further help. Thanks! 🙂
-Casey-
June 18, 2014 at 1:38 pm #233748Casey
Participantgerryleblanc,
If your issue is the same as the above please do feel free to monitor this thread, but if you need assistance for your own specific scenario it would be great if you could create a fresh thread of your own. Thanks!-Casey-
June 23, 2014 at 9:39 am #244651theukedge
ParticipantCasey,
The post about what changed at 3.6 with the widgets indicated that the loops are now contained within the template files. At first glance, it’s not massively obvious where the loop is, or if there’s a filter we can use to tweak it. Can you point me in the right direction?
June 24, 2014 at 8:56 am #247323Casey
Participanttheukedge,
The loop is just referring to the section of code in ‘views/pro/widgets/list-widget.php’ that begins with this:foreach( $posts as $post ) :When modifying template files, usually the best approach is just to override the file itself and modify the code that you need to modify. Take a look at my reply above regarding the themer’s guide. There’s tons of useful information in there, that I think will steer you in the right direction.
Just let me know if that answers your questions, or if I can help further. Thanks! 🙂
-Casey-
June 27, 2014 at 8:42 am #255234theukedge
ParticipantSorry – slip of the tongue. How about the query? If I want to modify the widget query (by adding in a meta_query), am I able to directly edit that, or run it through a filter. I checked through the links you sent and couldn’t see what I needed.
June 27, 2014 at 11:07 am #255650Casey
Participanttheukedge,
Yes, we have the ‘tribe_events_list_widget_query_args’ filter that should allow you to filter the args that are passed to the list widget query. Take a look at ‘the-events-calendar/lib/widget-list.class.php’ on line 92 to see where it’s being applied. Hope that helps! Thanks! 🙂-Casey-
July 17, 2014 at 6:59 am #428919theukedge
ParticipantHi Casey,
That was a good start, but my function doesn’t seem to be working. Perhaps you can see what the issue might be. When I use this function, it does return events that only have the meta_value of _ecp_custom_1 set to Featured, but it shows all of these events, including ones that have already passed, starting with the oldest. Furthermore, when showing these old events, it shows the start date as today’s date, but shows the end date correctly. Any idea why it’s not just showing upcoming events? (see screenshot: https://cloudup.com/cMET9659K3t)
Can you please let me know where I’m going wrong? Thanks
July 17, 2014 at 8:51 am #429854Casey
Participanttheukedge,
Try using a meta query in your args instead like this:'meta_query' => array(
array(
'key' => '_ecp_custom_1',
'value' => array( 'Featured'),
'compare' => 'IN',
)
)See if that does the trick.
July 17, 2014 at 10:08 am #430438theukedge
ParticipantNope, no dice. Here’s my revised code, but the outcome is the same…
July 17, 2014 at 10:11 am #430465theukedge
ParticipantOh wait… the file didn’t upload when I thought it did. It seems that that might have done it after all. Let me just check…
July 17, 2014 at 10:16 am #430509theukedge
ParticipantYep, all fixed. Much thanks!
July 17, 2014 at 11:40 am #431156Casey
ParticipantAwesome! Thanks for confirming that this got you sorted. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out.
By the way, if you have a minute or two, we would love it if you’d write a few words for us here: http://m.tri.be/lo
Thanks in advance. 🙂
Cheers,
Casey -
AuthorPosts
- The topic ‘Changes to list widget’ is closed to new replies.
