WordPress Post Like without Plugin

Recommended by 519 people
. in Tutorial, web . 1 min read
Recommended by 519 people

In muchad.com you can find love picture in every after post. This “post like” is integrated with my theme, medio theme.

Post Like in WordPress

Post Like in Medio Theme


I using Post Like system by Sven Hofmann’s, it’s pretty cool. This is the scenario:
When an anonymous user clicks the like button:
– User’s IP address is stored in the post’s meta as an array.
– These IP addresses are utilized to prevent anonymous users from liking posts more than once.
– Post like count is incremented +1 and stored in post meta.
When a registered user clicks the like button:
– WP User ID in the post’s meta as an array.
– Post like count is incremented +1 and stored in post meta.
– Post ID is stored as user meta.
– User like count is incremented +1 and stored as user meta.
 
If you want use it in your theme, you can read full tutorial in his website from this link or directly read his gist:



Responses
 
Write a response...
Your email address will not be published. Required fields are marked *

muchad.com Comments List
muchad.com comments
Rakhashree Das

It’s showing error when install the plugin

muchad.com comments

How did you make it work inside a query loop? I haven’t figure that out using the shortcode. If I like one of the post then all are liked. Is not choosing liking that particular post-id. Any thoughts?

    muchad.com comments

    The like is not saving for just that post in the loop.**