How can I add new action/feature to questions and answers?
You would need to write custom PHP code to achieve this.
It will be pretty simple, just mimic the upvotes logic.
(are you sure you want to add another likes system? there is already “likes” and “dislikes”, the thumbsup and thumbsdown icons near the number)
Me answering this question would mean me do the development. Hire me at 25$/hour, I’ll do it no problem.
I can tell you the steps you will probably need to walk in order to implement it:
– look at the “upvote” button. Make a new button near it with it’s own id/class. Duplicate the JS of upvote button to your button.
– look what that JS calls, duplicate it in your code.
– look where it stores the data, store your data same way in your code.
– look how and where upvotes data is displayed, implement methods to get your custom meta in the same way.
– find a good place to put your custom code. Most likely, template override and a code snippet will be enough. Could do a plugin.
– you are done, congratulations! Now you may repeat this process of reverse engineering to display your likes data in profiles as well.
TL;DR: there is no simple “hook” to do it in one line. A usual process of developing a feature should be done.
Which hooks/action should I use if I want to mimic the upvotes logic? (I couldn’t find a hook to add custom action/features).