• Resolved app17

    (@app17)


    Hi,

    I love that this plugin allows you to view events on the front page BUT I can’t quite figure out what query it’s using or how it builds it. I’m using a customised Events Calendar/Pro/Community query via a pre_get_posts filter but that’s not what’s appearing on the front page.

    Is it possible to hook into this query or override it so it appears on the front page too?

    Thanks!

    https://ww.wp.xz.cn/plugins/event-rocket/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Barry

    (@barryhughes-1)

    Can you provide any more detail/context?

    Thread Starter app17

    (@app17)

    Hi Barry! Hope the below is more useful! Let me know if you need more information.

    I have a functions.php in my theme for custom code. It includes a pre_get_posts filter which modifies the main WP query (in this case the one that returns tribe_events).

    It’s doing a few things e.g. ignoring the time component of upcoming events so all events are displayed for the whole of today.

    if ( $query->query_vars[‘eventDisplay’] == ‘upcoming’ ) {
    $query->set(‘start_date’, Date(‘Y-m-d’));
    }

    If I visit “mywebsite.com/events” my pre_get_posts filter is used and events are displayed as I expect. When I visit “mywebsite.com” (when using the Event Rocket plugin) I’m currently only seeing one event.

    I can see in the nosecone code that it uses the parse_query filter. Should I try and hook into this as well to make sure that my pre_get_posts filter params are being used too?

    Thanks!

    Plugin Author Barry

    (@barryhughes-1)

    Ahh, yes I think I see what you mean.

    You’re probably right and what EventRocketNosecone::parse_query() does may be impacting on the logic in your own code. As of the very latest release (1.4) you can probably change your logic to additionally test for the presence of an eventrocket_frontpage query variable, something like:

    if ( $query->query_vars['eventDisplay'] == 'upcoming' || $query->get( 'eventrocket_frontpage' ) ) {
        /* Your logic */
    }

    Might that help?

    Thread Starter app17

    (@app17)

    Hi again Barry,

    I just installed the latest version and everything is where it should be.

    Thanks for persevering with me!

    B.

    Thread Starter app17

    (@app17)

    Thanks – all sorted!

    Plugin Author Barry

    (@barryhughes-1)

    Awesome – thanks for letting me know 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Front page events query’ is closed to new replies.