• Resolved Jaakko P?ntinen

    (@jpontinen)


    Hi!

    When I make a query on events in the event list, the list automatically offers an RSS link matching the query. I have the event list set up so that the events closest to current time show on top.

    However, the RSS has the order backwards; the farthets away events are on top.

    How would I reverse the date order to be ascending, for all RSS feeds made by your plugin?

    Thank you ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Jaakko P?ntinen

    (@jpontinen)

    Adding: The feed also arranges the items by pubdate, it seems! That is not right in my use case. They should be arranged by the actual event start date, ascending from the closest day to current time down the list.

    Thank you! ??

    Hi @jpontinen,

    You need to bind custom query with this filter event_feed_args.

    add_filter('event_feed_args','custom_theme_name_event_orderby_feed');
    function custom_theme_name_event_orderby_feed($query_args){
    
    		$query_args['orderby'] ='meta_value';
    		$query_args['meta_key'] ='_event_start_date';
    		$query_args['meta_type'] ='DATE';
    
    return $query_args;
    }

    I hope this will help. In a future version, we will implement this feature by default. Above code is not tested but you can work with that filter.

    Thank you

    Thread Starter Jaakko P?ntinen

    (@jpontinen)

    Thank you!

    The filter effects the correct things – one more thing, how to reverse the order now that the feed is sorted by start date? As of now, it still starts from the event furthest away.

    – JP

    Thread Starter Jaakko P?ntinen

    (@jpontinen)

    Added this to your awesome answer:

    $query_args['order'] ='ASC';

    And that was all it took!

    Thank you! Resolved 100%

    same problem here – where should i add this code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘RSS feed reverse date order’ is closed to new replies.