Set Item Order to Alphabetical

The order of feed items in our shortcode and block displays (via the templates) is always in descending order of the date, meaning the latest item is always displayed up top and the oldest item is displayed at the bottom.

The filter below changes this to display the items in alphabetical order instead. Please note that this specific filter will change the order of all the feed item displays on your site, no matter the source or the template being used.

add_filter('wpra/templates/feeds/feed_item_collection', 'wpra_sort_feed_items_alpha');
function wpra_sort_feed_items_alpha($collection) {
    return $collection->filter([
        'order_by' => 'title',
        'order'    => 'ASC',
    ]);

Still need help? Contact Us Contact Us