kylephillips / favorites

Simple and flexible favorite buttons for any WordPress post type.
https://favoriteposts.com
223 stars 86 forks source link

[Feature Request]: Change the order of favorites list #173

Closed DivvyPT closed 1 year ago

DivvyPT commented 1 year ago

Really great plugin! 😀

How can the order of a user’s favorites in his favorites list be changed so that the last post that was added to the list is displayed on top instead of at the bottom of the list?

I've found a 5 years code, but I don't know how to apply it: If you change line 80 from the getFavorites() function within the /favorites/app/Entities/User/UserRepository.php file to the following you should be able to reverse the results.

return array_reverse($favorites);

Can someone please help me? Thanks in advance!

DivvyPT commented 1 year ago

Solved!

FIND: $favorites = apply_filters('favorites/user/favorites', $favorites);

FIND AFTER: return $favorites;

REPLACE WITH: return array_reverse($favorites);