Home › Forums › Calendar Products › Community Events › Integrate events with main blog – control # and order
- This topic has 3 replies, 2 voices, and was last updated 10 years, 5 months ago by
George.
-
AuthorPosts
-
November 13, 2015 at 11:35 am #1025430
barback
ParticipantI’ve turned on the option to “Include events in main blog loop” – but it includes ALL of my events, including ones that have gone by, and it orders them to list the farthest out event first and the farthest past event last.
What I’d LIKE is to feature only the next UPCOMING THREE events in my main blog loop.
November 16, 2015 at 6:37 am #1026350George
ParticipantHey @barback,
Thanks for reaching out – I’m sorry to bear this news, but what you described is essentially the default way the “Include events in main blog loop” option works. Altering this to only include the next 3 upcoming events is a bit tricky and would require writing custom code 🙁
The customization of this outright is a bit too complex for full code support here on the forums, but if you’re keen on enabling this limitation on your site, you can find the relevant code by going to this file in your The Events Calendar plugin files: src/Tribe/Query.php
Around line 158 you’ll find the relevant code. With this file and/or the action tribe_events_pre_get_posts() you can customize the query output. You’ll need some familiarity with WordPress’ own pre_get_posts() function, which you can learn about here if you’re not familiar with it → https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
I hope this information helps!
— George
November 17, 2015 at 6:10 am #1026966barback
ParticipantThanks George for pointing me in the right direction.
I’m a bit surprised that The Events Calendar offers this option as is, because I can’t imagine who would want to promote their most distant event at the top of their blog, leaving current or soon to happen events buried in the midst.
If the events posted in order of their creation or publication, vs. the order of the event’s date, I would have some more control and could force the ones I want to feature to the surface. As it is, I will have to do the custom coding you suggest, or abandon your “feature” and create duplicate content in the form of posts.
Anybody have any other ideas?
November 18, 2015 at 12:22 pm #1027684George
ParticipantHey @Barback,
To be clear, the most-distant event should only really be displaying before more recent events if other plugins or your theme are also manipulating the main Queries on your site.
The tribe_events_pre_get_posts() function I wrote about above may indeed be a way out of these issues. If you are not comfortable with editing code, your best bet is to hire a professional. We have a list of some highly-rated ones here, just in case it’s helpful → http://m.tri.be/18k1
I’m sorry about these limitations 🙁 I will close up this thread for now but wish you the best of luck with your site.
Sincerely,
George -
AuthorPosts
- The topic ‘Integrate events with main blog – control # and order’ is closed to new replies.
