How to sort feed items by title

You can use this code snippet to sort the feed items alphabetically by their title: 

function tifd_feedzy_feed_items_alphabetically( $items, $feedURL ) {
	if ( 'http://themeisle.com/blog/feed' == $feedURL ) {
		usort( $items, function ( $a, $b ) {
			// You can switch the parameters to ge the reverse order. 
			return strcmp( $a->get_title(), $b->get_title() );
		} );
	}

	return $items;
}

add_filter( 'feedzy_feed_items', 'tifd_feedzy_feed_items_alphabetically', 9, 2 );


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us