Sort order issue with Community Event RSS

Home Forums Calendar Products Community Events Sort order issue with Community Event RSS

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1590102
    focusphoto
    Participant

    Hi 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 5 years, 8 months ago by focusphoto. Reason: further clarification
    #1590121
    focusphoto
    Participant

    Actually 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. 🙁

    #1590146
    focusphoto
    Participant

    Just 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');
    #1591450
    Cliff
    Member

    Hi, 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!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Sort order issue with Community Event RSS’ is closed to new replies.