I want to add an option for logged in users to "like" posts. Then those likes would not only display the count on the post but also show up in a view or search (and be able to sort by them). Do you happen to know of a good plugin for this that you'd recommend. Since we're going to be using a lot of the toolset tools I thought it might be good to see if you had any experience or recommendations.
Hi, I don't have a great recommendation on this but I can offer some technical advice. If you want to sort a View of posts using the number of "Likes" or "Favorites", the plugin you choose must store that number in a custom field associated with the post. Other solutions that store likes externally (like a Facebook widget) would not be sortable. The author of another plugin would be able to tell you whether or not their plugin works by incrementing/decrementing a standard postmeta field to manage "likes". If so, then you might have luck integrating it with Views sorting. A supporter here would be able to check the database and determine whether or not that custom field can be sorted upon.
Some third-party plugins use hidden custom fields. We have more information about sorting a View using hidden custom fields here: https://toolset.com/documentation/user-guides/custom-content/using-third-party-hidden-fields/
If you want to track individual Users' favorites, it's more complex because not only do you need to store the total number of likes in a custom field on the post, you must also figure out a way to store which User liked which post, and probably allow them a mechanism to dislike as well. That means storing the User ID in a repeating field on the post, or storing the post ID in a repeating field in the User Profile. A complex custom code solution to handle something similar is discussed in another ticket:
https://toolset.com/forums/topic/method-for-user-to-choose-post-as-favorite/
I'm happy to run a quick test with any plugin you decide to try. Feel free to search the forums for the name of any plugin you want to vet, it's possible other Users have posted here about their findings.
Thanks Christian. I think I'm looking at possibly this one: https://wordpress.org/plugins/likebtn-like-button/
When I looked I found this which makes it seem like it's added in a meta field https://wordpress.org/support/topic/sort-posts-by-likes/ (when looking at the code).
I'm thinking I'm going to have a like button (so we can see which are most liked), and also a favorite (which would list items in their profile). That way they can choose which ones they want to follow/remember vs just saying they like it. And likes would be used for sorting where favorites/bookmarks is just for them personally.
Looking at hidden link for the favorites.
Going to go digging. If you get a chance to look, great, if not it's ok. Don't really consider it part of your job at that point (I'm a dev, just don't do a lot of WP).
Thanks Christian. I think I'm looking at possibly this one: https://wordpress.org/plugins/likebtn-like-button/
I did a quick test and it's not looking good. There is a proprietary table added to the database to store likes, not a single postmeta value associated with a post. I think they may have changed how likes are stored since this post was created 2 years ago.
Thanks. I may look at some others like https://wordpress.org/plugins/wp-ulike/ . I appreciate all the time you spent.
My issue is resolved now. Thank you!