Home › Forums › Calendar Products › Community Events › Sort order issue with Community Event RSS
- This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by
focusphoto.
-
AuthorPosts
-
August 3, 2018 at 6:35 pm #1590102
focusphoto
ParticipantHi guys,
We use your Community Events pro plugin, and need to use the event RSS Feed in a particular notification system.
Unfortunately running into an issue with the sort order – looks like your plugin rss sorts the NEW items at the BOTTOM. i.e. Instead of having NEW items at the TOP, how it should be sorted and how the normal wordpress RSS feed works.
This is throwing off the service that needs to use this feed for us, and items are not getting picked up.
Can you please direct me to the Code hooks that we can use to modify this behaviour?
p.s. yes I have noticed adding the ?order=desc to the url parameter fixes the problem, but we are unable to pass URL parameters in this particular use case.
So I need to ensure the feed is sorted by DESC by default. That’s why I am requesting the appropriate hooks that we can override in functions.php.
Regards
Arun-
This topic was modified 7 years, 8 months ago by
focusphoto. Reason: further clarification
August 3, 2018 at 7:22 pm #1590121focusphoto
ParticipantActually I have found this help document which has the code snipped for ordering Events by Publication Date:
https://theeventscalendar.com/knowledgebase/customize-rss-feed/add_action( 'pre_get_posts', 'custom_teardown_tribe_order_filter', 60 ); function custom_teardown_tribe_order_filter() { if ( is_feed() ) remove_filter( 'posts_orderby', array( 'Tribe__Events__Query', 'posts_orderby' ), 10, 2 ); }However it is not working correctly. Still shows events added later to the bottom of the feed. 🙁
August 3, 2018 at 10:22 pm #1590146focusphoto
ParticipantJust wanted to report back that I added this bit of extra code to force the descending order sort.
This – along with your code above for using published date, has fixed the behaviour.
// Change sort order of RSS to Desc -> i.e. NEW posts at TOP. function alter_wp_sort_desc( $request ) { $dummy_query = new WP_Query(); $dummy_query->parse_query($request); if($dummy_query->is_feed()) $request['order'] = 'DESC'; return $request; } add_filter('request', 'alter_wp_sort_desc');August 6, 2018 at 3:26 pm #1591450Cliff
MemberHi, Arun. Sorry for the wait over the weekend. Please be aware of our working hours: Scope of Support
Thanks for sharing your solution. I’ll mark this thread is Closed, but feel free to open a new thread if you need anything more.
Have a great week!
-
This topic was modified 7 years, 8 months ago by
-
AuthorPosts
- The topic ‘Sort order issue with Community Event RSS’ is closed to new replies.
