• Resolved MartaLi

    (@martali)


    Hello!

    I am using Event Rocket 2.5 with Events Calendar 3.8.1

    I need to show the upcoming events in the home page for which I used the following code:

    [event_embed limit="3" from="now"] {thumbnail} {start_date} {title} [/event_embed]

    Much like it is stated in this thread, I have events that stay active for a long period of time, and therefore they are showing up before the events that will actually start now.

    For example I have these events:
    Course #1 from Jan 1st 2015 to Apr 4th 2015
    Course #2 from Mar 7th 2015 to May 6th 2015
    Course #3 from Mar 30th 2015 to Jun 20th 2015
    Course #4 from Jun 6th 2015 to Jul 15th 2015

    With the shortcode I am using I was expecting to show only courses #3 and #4 since they are the upcoming events. However it is showing also courses from #1 and #2.

    I need to show only the upcoming events with a start date from today onwards. I do not want to show events that already started and are taking place even though they aren’t yet completed.

    Please let me know what could be done to achieve this.

    Thank you!

    https://www.ads-software.com/plugins/event-rocket/

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

    (@barryhughes-1)

    Hi!

    What you’re experiencing is the expected behaviour.

    Event Rocket is really just piggy-backing on The Events Calendar itself and, when you query for events in a certain time range, the current behaviour is to include all events that start or have not expired within that period.

    You can certainly alter this behaviour by changing the conditions within the query itself and, if you generally are happy with the way The Events Calendar behaves in this regard and only want to see this change in respect of the [event_embed] shortcode, that’s possible too:

    • A filter hook – eventrocket_embed_event_args – runs right before the shortcode’s event query
    • Simply by using this as a convenient jumping off point, you can consequently modify the query using standard WordPress hooks such as posts_where
    • So as to avoid impacting on other queries, be sure to tear down your callbacks once the changes have been made

    …As you can see this sort of change would require you to be fairly comfortable with coding and developing in a WordPress environment ??

    It’s possible I will consider adding a new shortcode parameter to make it easier to lock things down in the way you have described – date-logic="strict" or something – however I’m not fully sold on the idea just yet.

    Thread Starter MartaLi

    (@martali)

    Hey Barry,

    Thank you for your kind reply and help. I will try it as you suggested. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Upcoming events shortcode’ is closed to new replies.