Home › Forums › Calendar Products › Events Calendar PRO › Upcoming
- This topic has 12 replies, 5 voices, and was last updated 9 years, 2 months ago by
Daniel.
-
AuthorPosts
-
January 23, 2017 at 4:09 am #1222265
Daniel
ParticipantHi,
on my pages I publish our trainings. The most of them are more month long. So I want to list these events on the homepage, but only the upcoming events. Is it possible to hide the events that already began?Thank alot
Daniel
January 24, 2017 at 5:55 am #1222889Josh
ParticipantHey Daniel,
Thanks for reaching out to us!
To clarify a couple of things here,
- How are you wanting to feed the events into your home template? One of our default widgets? Some custom code in your template?
- For the list, you want to exclude any event where the start date of the event has already passed even if that event is a currently running event?
Thanks!
January 24, 2017 at 6:45 am #1222907Daniel
ParticipantHey Josh,
thanks for you reply. If possible I would like to feed it with a widged or another solution?
You are right, I want to exclude every event that has still started. Because our trainings a many month long and the costumers need to complete the whole time of a training.Thank you for helping me.
Daniel
January 26, 2017 at 7:57 am #1224370Josh
ParticipantHey Daniel,
Thanks for following up here!
Sure thing! You can use our Event List widget and then filter the query args to only get events that have start dates passed the current date.
For this, you would use the “tribe_events_list_widget_query_args” filter. That filter works to modify the arguments that will be passed to our “tribe_get_events” function. For that you could do something like:
add_filter( 'tribe_events_list_widget_query_args', 'custom_widget_filter' ); function custom_widget_filter( $args ) { $args['start_date'] = current_time( 'Y-m-d' ); }Let me know if this helps.
Thanks!
January 26, 2017 at 8:13 am #1224382Daniel
ParticipantI’m sorry, please explain how to use such widget and how to modify it. Is it a kind of shortcode to use in a post or do I have to put the code in the functions.php?
Thanks for your reply
Daniel
January 27, 2017 at 11:58 am #1225358Josh
ParticipantHey Daniel,
Thanks for following up.
Our plugin comes with the Event List widget so you can add that to the widget area that you were wanting to use it in.
After that, you would use the code to filter the query for the widget by adding it to your theme’s functions.php file or you could use a code snippet type of plugin.
Let me know if this helps.
Thanks!
January 29, 2017 at 11:50 pm #1226041Daniel
ParticipantDear Josh,
thanks! Something changed in the view, but not what I wanted. Take a look at the screenshot. I use the widget on my frontpage and I set the mount of events to 3. But it shows me 10 events with a start date August 2016. Take a look here http://www.bildungswerk.de .
Daniel
January 31, 2017 at 8:37 am #1226947Josh
ParticipantHey Daniel,
It looks like I forgot to add the last line in that function where you return the $args:
add_filter( 'tribe_events_list_widget_query_args', 'custom_widget_filter' ); function custom_widget_filter( $args ) { $args['start_date'] = current_time( 'Y-m-d' ); return $args; }That should address half the issue, however it looks like that argument for “start_date” doesn’t actually use that as an “events that start after this date” type of filter. Will need to think of an alternative approach which might be a manual check on the start date from the results. I’ll have to do a little playing around with this and get back to you.
Thanks!
February 5, 2017 at 11:19 pm #1229805Daniel
ParticipantHey Josh,
I’m sorry, there’s no more error anymore but it seems to do nothing. If I delete the code from the function.php it’s the same result.
Daniel
February 9, 2017 at 9:20 am #1232193George
ParticipantHey Daniel,
Thanks for your patience here. We’re still tinkering with a code snippet here for you but will have one coming soon! Stay tuned 😀
— George
February 16, 2017 at 9:14 am #1238825George
ParticipantHey Daniel,
I’m sorry to bear this news, but this customization was much harder to pull off than expected and we have not been successful in creating it. 🙁
I won’t be able to come up with a solution here like we tried.
I am sorry to disappoint! Please let me know if there are any other issues or questions I can try to help with.
Sincerely,
GeorgeMarch 10, 2017 at 8:35 am #1252395Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Upcoming’ is closed to new replies.
