WordPress Post Like without Plugin

Recommended by 108 people
. in Tutorial, web . 1 min read
Recommended by 108 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:



Other stories written by muchad
Recommended stories
Responses
 
Write a response...
Your email address will not be published. Required fields are marked *