Changes to list widget

Home Forums Calendar Products Events Calendar PRO Changes to list widget

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #233427
    theukedge
    Participant

    I 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

    #233732
    gerryleblanc
    Participant

    I’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?

    #233736
    Casey
    Participant

    theukedge,
    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-

    #233748
    Casey
    Participant

    gerryleblanc,
    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-

    #244651
    theukedge
    Participant

    Casey,

    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?

    #247323
    Casey
    Participant

    theukedge,
    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-

    #255234
    theukedge
    Participant

    Sorry – 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.

    #255650
    Casey
    Participant

    theukedge,
    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-

    #428919
    theukedge
    Participant

    Hi 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)

    http://pastebin.com/FgZN6gX1

    Can you please let me know where I’m going wrong? Thanks

    #429854
    Casey
    Participant

    theukedge,
    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.

    #430438
    theukedge
    Participant

    Nope, no dice. Here’s my revised code, but the outcome is the same…

    http://pastebin.com/62518LS8

    #430465
    theukedge
    Participant

    Oh 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…

    #430509
    theukedge
    Participant

    Yep, all fixed. Much thanks!

    #431156
    Casey
    Participant

    Awesome! 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

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Changes to list widget’ is closed to new replies.