Past / Recent Events List

Home Forums Calendar Products Events Calendar PRO Past / Recent Events List

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1039082
    lewiscenterarts
    Participant

    I’ve seen discussion threads in these forums regarding the ability to show the most recent # events in a simple list widget going back several years (to version 2.x), but no clear solution or guide to implementation. Is this still on the roadmap for future releases?

    When I have tried to adapt plugins like Advanced Recent Posts (set up to pick up recent posts from the custom post type “Events”) it grabs the publication date, not the event date. On a site with 500+ past events, each of which is published initially when the details become available, this is a problem.

    Any advice would be so appreciated … I’m this close to enlisting a Codeable expert to build something from scratch here, which I’ll happily share if it would be of use to others, but I don’t want to reinvent the wheel. Thanks!

    #1039792
    George
    Participant

    Hey @Lewiscenterarts,

    We have a “list widget” that might meet your needs here – here are two articles worth checking out to determine if so:

    • https://theeventscalendar.com/knowledgebase/events-calendar-widgets/
    • https://theeventscalendar.com/knowledgebase/configuring-the-list-widget/

    If the List Widget / Advanced List Widget are not adequate for your needs, can you clarify exactly why? Is it just the way the events are sorted, for example? Let me know and I can help point you in the right direction for the next best steps if the default widgets are not adequate.

    Thank you,
    George

    #1040865
    lewiscenterarts
    Participant

    Thanks for the quick reply George. I’m familiar with the List Widget but it does not offer the option to display past events — only upcoming events.

    I consulted the knowledgebase for guidance on theming/customizing the widget, reviewing each of the tutorials here: https://theeventscalendar.com/knowledgebase-category/customizing-widgets/

    … However there is no instruction as to how one might modify the widget to show recent events. Is there a particular hook I could use, to change the way this behaves?

    As I mentioned, I’ve seen discussion of this issue many times before. I can’t be the only user who has a need to showcase a handful of recent events in a widget … e.g., “Here’s what we’ve been up to.”

    Thanks for your guidance.

    #1041123
    George
    Participant

    Thank you for elaborating here!

    Changing the widget sufficiently to show past events is indeed, unfortunately, a bit tricky 🙁

    It can be done, though. Basically, you’d need to alter the query arguments for the call of tribe_get_events() that powers the event display in the list widget.

    That call, in the plugin code, looks like this:


    self::$posts = tribe_get_events(
    apply_filters(
    'tribe_events_list_widget_query_args', array(
    'eventDisplay' => 'list',
    'posts_per_page' => self::$limit,
    'tribe_render_context' => 'widget',
    )
    )
    );

    So, you can change those arguments by using that filter in your theme’s functions.php file. So you could add like this to your theme’s functions.php file, for example, to change the ‘posts_per_page’ ( which is the number of events ) to 20:


    add_filter( 'tribe_events_list_widget_query_args', 'tribe_support_1039082' );

    function tribe_support_1039082( $args ) {
    $args['posts_per_page'] = 20;
    return $args;
    }

    That example is simple – just changing the number of events that will show up.

    But now the tricky part: changing the order of events to include past ones.

    The whole customization here is far outside the scope of support we can provide for customizations, unfortunately, but in general you would want to read up on the tribe_get_events() function and on the WP_Query class as listed here respectively:

    • https://theeventscalendar.com/knowledgebase/using-tribe_get_events/
    • https://codex.wordpress.org/Class_Reference/WP_Query

    First step would be to make the ‘eventDisplay’ argument be ‘custom’, which will just make the query easier to work with:


    add_filter( 'tribe_events_list_widget_query_args', 'tribe_support_1039082' );

    function tribe_support_1039082( $args ) {
    $args['eventDisplay'] = 'custom';
    return $args;
    }

    Then, you could start adding meta_query arguments from WP_Query to start specifying which event start dates should be included in the query. You can get started reading about this here → https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

    I’m sorry if all of this information is still too vague; it’s a complicated customization, unfortunately. If you are in dire need of this feature on your site and are willing to hire someone to implement this for you, one more thing that might be helpful is this list of highly-rated customizers that we maintain → http://m.tri.be/18k1

    I hope this all helps! 😀

    Sincerely,
    George

    #1076212
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Past / Recent Events List’ is closed to new replies.