I likes this and so does wordpress
Posted: April 20th, 2009 | Author: Aakash Bapna | Filed under: tech | Tags: wordpress, wp-plugin | 96 Comments »Atlast I am able to port the ”likes” feature from facebook to this blog using only the wordpress API, no dirty hacks!
Currently it allows visitors dropping by your blog to ‘like’ your posts if they find it interesting. Of course only once, they can unlike it if the did so by mistake or just to play around with this awesome feature.
Now the big question- Can I track who liked my post?
Well yes.. if the user is a registered member of your site 0_O // work being done on this folks, any ideas? chip in..
You can download the 1.0 beta bits of the WP likes plugin from here.
Upload the extracted zip folder to your wp-content/plugin directory of your blog. It will automatically appear in the plugin section of your Admin Panel, simply activate it from there.
In the next coming days I will work on packaging it even better and get it to the wordpress directory.
[UPDATE 1 ] The plugin is available directly from wordpress directory- http://wordpress.org/extend/plugins/wp-likes/ jQuery is now fetched in its best form(minified,GZIPed, ~20kb) at lightening speed from Google servers. The jQuery dependency will fade away in future releases.
[UPDATE 2] The version 1.1 is released with a lot of critical fixes, please give it a shot again if it was failing previously.
[UPDATE 3] Just commited the 2.0 version to the svn repo. Brings you a lot of customization, dashboard stats widget and sidebar. Will make a new post soon about it, till then take it for ride and keep the feedback coming!
WP likes 2.0 features and highlights.
So LIKE this?? then jump on the link below.



I was looking for something like this.
Good work genius!
I like this Plugin but I can’t get it to work I get this Fatal Error:
Parse error: syntax error, unexpected T_STRING,
expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /www/htdocs/w0095634/blogV2/wp-content/plugins/wp-likes/api.php on line 6
It may be because you are not on php 5.2.
What php version your web server is using?
Your right I use PHP 4.4.8.
Excellent work, thank you. Are there any plans to extend this to being able to like comments?
Arrgghh. Now I come to install it I find the dependency on jQuery has bitten me on the ass. Still a great plugin but I need one without jQuery
Hey, great plugin – only problem: isn’t working
First I had to change URL’s in the code (from “… /plugins/likes/ …” to “… /plugins/wp-likes/ …”) because automatic installation named the folder “wp-likes”.
Secondly I had to fix that jQuery thing by just putting a reference into my wp-index.php and wp-single.php.
Now, the first steps work: I can “like” and “dislike” my articles… but the plugin won’t remember. Refreshing the page will destroy my choices of liking… moreover I looked up in my wp-mysql-database and found no table created by the Likes-plugin. Is that normal? – and how can I tell the plugin which database to use?
Thank you in advance
@kev. yeah I am planning to extend it to comments once it works robustly on posts. jQuery is for adding the UI effects to the plugin to make it more lively.. its just 20kb, and comes directly from google servers.
@Marcus thanks for reporting the issues. There was a small glitch in automatic folder’s name and svn repo. This was the root cause of all the problems.
Now I have fixed those bugs and you can go ahead and install the plugin from WordPress directory. It will automatically create a table with suffix ‘likes’ in your wp db upon activation.
Thanks… after installing the new version, I found the Likes/WP-Likes problem fixed – but it’s not creating any table yet…? (and by this doesn’t remember my ‘likings’)
You got an idea what I’m going wrong with?
I think the plugin activation hook which creates tables if not present is not working properly at your end. Can you deactivate and renable the plugin ?
You can find the SQL query to create tables manually in the function ‘wp_likes_activate’ in plugin file. The table will be of name-
‘wp table name prefix(if any)’+'likes’
Let me know if you are comfortable with doing this else will put a button in admin panel for it
Well, I guess it wasn’t jQuery after all. Works fine now
I’ll just do a little CSS tweaking and hey presto. Thanks again. Great plugin.
Suggestions for the future
1) Have a thumbdown to sit next to ‘unlike’
2) Let the like/unlike links set next to stats – as oppose to sliding below
3) Let bloggers place plugin where we want to.
These are just my 2p. Its a great plugin.
Wow! Now I tried to manually enter the table creation command – and MySQL told me there is something wrong with charset = latin1 – so I removed this part from likes.php and now it works! Yeah!
I also had to change the path of the images so it would include “blog” in the path. The big problem I’m having is that the table won’t create so nothing is being stored.
I created the database by pulling the create script from the php and pushing it through mysql admin. So now, the only thing is that the script doesn’t update the database at all, so still no dice.
Is there any way I could use a PHP function to call it so that I can put it somewhere other than at the end of the post content?
I’ve sadly had to turn it off again – its incompatible with Featured Content Gallery plugin http://www.featuredcontentgallery.com/
The plugin does not work for me sadly. I don’t know why but it just doesn’t do anything at all. Checked the error console but there isn’t any error either…
Any thought?
Just a couple of bugs I ran into…
1) If the wordpress install isn’t in the root of the domain, the images won’t show. I was testing this in a folder called /beta, and had to hardcode that in. I’m sure there’s a better way fo defining it, but I’m not too sure.
2) I corrected the above, but even after clicking on the like button, the message didn’t update. The spinner did go round, though.
Damm bugs again..
@Bob, try the latest release, it should create the tables for you automatically upon activation.
@Dan nope, but will add the like box CSS editing option in admin cp soon.
@Kev where is it crashing? I am gonna try out that plugin
@David,Joseph
I have fixed ALL the issues with paths by querying wordpress using get_option(‘siteurl’) function. Please give it a try yet again by downloading a new release from- http://downloads.wordpress.org/plugin/wp-likes.zip.
And thanks for your suggestion guys. I will start working on this again, later this month after my exams get over.
Hurray
working like a charm now although will it always stay “you like this vote” once you voted? well nevermind I’ll get my hands dirty and tweak it a little.
Is there a way to only show it when you are on a single post and not on the primary page? ..and is there a way to change the position of it?
Great plugin nonetheless!
Its working fine but i had to Deactivate it today. Because of Poor AJAX programming. Google has indexed following page
Title: {“uid”:0,”success”:false,”error_txt”:”invalid method”}
Desc: {“uid”:0,”success”:false,”error_txt”:”invalid method”}
URL: domain.com/wp-content/plugins/wp-likes/endpoint.php
Waqas,
Just released a patch for that issue. Please upgrade your plugin. I am really sorry that this garbage was indexed by Google.
Works with Featured Content Gallery perfectly too
great work
Excellent work!! this plugin is *almost* perfect!
I would like to see, in a new version, the button “dislike”. So we can know how many people like *and* dislike some post.
I think facebook had this funcionality (dislike) for a while…
thanks!
Thanks Aakash Bapna for the Quick fix, I have upgraded it and let you know about issues if any. Thanks again
Hi!
I get the same error as Beyond Remedy has.
(
Parse error: syntax error, unexpected T_STRING,
expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /www/htdocs/w0095634/blogV2/wp-content/plugins/wp-likes/api.php on line 6
What can I do??
Same error here, and my server says its using PHP 5.2x.
(note wordpress is not installed in the domain’s or blog’s root folder, but it’s own folder titled “WP” inside the root folder).
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /WP/wp-content/plugins/wp-likes/api.php on line 6
Nevermind. My server’s web panel made it appear I was running 5.2.x, but it looks like it was just showing me the option to update to 5.2.x (a little confusing). Once I “saved changes” (even though 5.2.x was already visible in the dropdown box next to PHP), the plugin seems to have activated just fine.
Appears to be working, HOWEVER– For some reason, the “like” button does nothing when clicked in the browser Camino (a mozilla-based Mac browser). It does work in Safari and Firefox, however.
Hi Aakash,
Great plugin! One problem in IE though =/ I’m using it with the P2 theme and when it’s activated, every post has a right-hand scroll bar. Any ideas? (This is on IE8, not sure about IE7)
Thanks in advance!
@Rodrigo Facebook never had “dislikes” or any thing like “hate this”. The reason behind this I guess is you want to spread likeness, not hatred in the world
@mike does that browser have any javascript console, where you can see the javascript error occuring when you click “like”.
@jon can you mail me the screenshot of whats breaking the UI to me[at]aakash[dot]me to diagnose the CSS issue.
I get below error while i try to activate plugin. I Liked your polling too much but,alas! not working for me.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /var/www/html/vShare/wp-content/plugins/wp-likes/api.php on line 6
Santosh, this plugin requires PHP 5.2. You need to upgrade from PHP 4.x to get this plugin working.
Hi Aakash!
Great thing your plugin. Thanks.
But…
I was wondering if there is the possibility of changing the position of wp-likes from post-bottom to the post-top. Doing it with CSS seems to be uncool because setting up the position isn’t working with the changing post-lengths.
Thank you so much for your upcoming feedback.
Lucas
yeah i’d also like to know @lucas …
thanks for the answer – and the great plugin!!
@anna, lucas I am planning to put a option for that in next version which I am gonna work on soon.
Till then u can change line 104 in likes.php which is
return $content.$returnStr;
TO
return $returnStr.$content;
This will get the like’s div before the content of post.
Aaaiiiiight !!!
Thanks Aakash
Lucas
thanks so much man – keep up the great work!
Hi there!
I have the same question like Philip: Is there a way to only show it when you are on a single post and not on the index page?
Already love that plugin! THX!
[...] In: WordPress plugins 16 Jun 2009 Atlast I am able to port the “likes” feature from facebook to this blog using only the wordpress API, no dirty hacks! Go to Source [...]
[...] Permite que los visitantes de tu blog “voten” si les gusta o no el articulo que se encuentran leyendo, parecido a la opción que brinda FaceBook. Es una buena forma de demostrar el “valor” de tu entrada, ya que muchas personas se abstienen de publicar comentarios a pesar de que encontrar un contenido interesante. [...]
Hi, i like your plugin so much. I translated to Turkish. if you want, i can send the codes
great plugin thanks
I am trying to get my site XHTML valid, and your plugin reports TONS of errors. Here’s a link that shows that your blog here has those errors too: http://tinyurl.com/lfjr35
What needs to be done to fix this?
Also, if you visit my site, I have taken your plugin and modified it to perfectly fit my site. Let me know what you think.
I love it, but is it possible to make it not appear in “static” pages?
I had this added to my site, however it was working perfectly, and then today after the upgrade, it’s not working at all..
I think there’s an error in the code, but I’m no coder! lol
this is what shows in the “link” when you hover over to change to like..
javascript:wp_likes.like(508)’%20title=’Like%20this%20post’><img%20src=’http://ukwins.info/wp-content/plugins/wp-likes/images/like.gif
I’ve found out what it was – the code is interfering with google analytics for WordPress…, which I’ve just turned off, and it seems to be working fine again..
Any ideas?
and further info as well..
I’ve just turned the analytics plugin back ON
and turn off the tracking for outbound..
it starts to work again!
( http://UKwins.info )
XHTML validation issues have been resolved. They were occuring due to unexpected behavior of the ‘wpautop’ filter.
I am taking into account all the suggestions that have been posted in comments and will soon start working on a major upgrade.
Thanks for the feedback guys
keep ‘em coming…
new version still won’t allow you to track outbound links in Google Analytics.. ( 1.2 )
excellent plugin.
“Like” shows up in every page how do I disable from certain pages, like “contact us” or “about us” page?
and when is the admin page coming?
keep up the good work.
Great! just what our community site needed.
We made a decision at the start though, to call posts ‘articles’ so I just needed to edit the api.php and likes.php files to substitute that word to make it perfect for us.
Well done Craig and thank you.
Just had to deactivate it as I noticed that the photo galleries were no longer displaying images using lightbox but just opening in a window.
I’m using WP2.7.1 and GalleryPlus plugin – any way to make it compatible with this? Also – I’d also prefer as others have said to not have the likes shown on pages just posts can that be included in a new version too?
great plug in!
2 questions/comments.
1. can you possibly edit the plugin is not so linked to ‘addfilter’ to run. id love to just have a function to call to run it. then i could put it elsewhere..
2. whats up with injecting the css via the api.php file. not intuitive and a bit of a pain to customize
other then those gripes this is my new fav plugin
@craig
i was having that same problem earlier (the link showing up incorrectly)
I am not sure your level of comfort in the plugin editor, but i was able to fix it.
In short, for some reason wordpress changes the leading ‘ into a ” thus messing up the href and everything after it..
if you go into the plugin editor > likes.php
find where it says href=’javascript on lines 87 and 95.
and change it to read href= ‘ javascript
note that all i am doing is adding a space before and after the ‘
and then it worked
m!
I’m sure it’s been said already, but some customizable css and the ability to put the code wherever we want would be FANTASTIC. Thanks for the great plugin!
I have installed the 1.2.0 on php 5.2.9 and WordPress 2.6.1
It is not working. All plugins have been disabled and tested with Like alone, still nothing. The database is there, there is no errors and the DB checks OK.
I get the swirling javascript, but nothing further.
Thanks
[...] 16. wp likes [...]
[...] Yazıyı beğenme/beğenmeme eklentisi: Facebook tarzı, yazıları beğenip beğenmeme [...]
This weekend an update is coming, should bring all the awesomeness you guys are looking for..
P.S. what you think about like to subscribe to comment and post updates like FB?
The more things people can click to like the better!
Looking forward to the weekend’s update.
Fantastic! Being able to edit that CSS is a HUGE help. However, the code snippet doesn’t seem to be working… I tried it with the setting checked, and with and without the ‘Visible on posts on front page’ option checked. Any which way, the likes option doesn’t display where I put the code, and if they’re both checked, the default likes won’t display either.
Hopefully it’s nothing major! Just thought I’d give you a heads up.
Oop. and when I click to like something I haven’t already, it shows “0 people like this post” instead of “You like this post”
Hi, thanks a lot for this plugin. I have been using it since the first release and I have been translating it into spanish. Now it has been a little bit more difficult, I just did half of the translation. So if you want the spanish version (I do!) I can help you with words, but I need help with the code.
Hi!
I reall like this plugin, but there are some few thing I hope you can add.
- What I understand, I cant place this plugin where i want at my posts, I want to have it after my comment-link. So it would be lovley if it could be a function that you can place the “like” plugin where ever you want.
- It would be lovley to recive an email when someone “like” the posts. If they “like” old posts its easy to miss it.
– It would be nice if the Thumb-pic and the counting of how many pepole who “likes” it could be on the same line!
Please answer to my email adress.
@local landing
everything should be fixed now with 2.0.1.
thanks for reporting those,, I kinda rushed up for the release
There is new code for calling the plugin anywhere you want-
<?php if(is_callable('wp_likes_render::post')) wp_likes_render::post();?>Put this in your theme file whereever you want likes to appear.
@Marilu
This release was meant to simplify translations by putting text in the settings. Anyways send me the translations at me[at]aakash[dot]me, I will map them to likes.php file and send you back.
@Rebecca
There’s a way as I pointed earlier in this comment to render the plugin wherever you want.
I am still tweaking the designs will test that too and see how it works out.
emails could be spammy? but yea we can put a date check to mail only for older posts.. this will be coming once I figure out to track the person who liked the post.
I put the code in my “index.php” file, but it doesent work
I think the design would be more discret, and cleaner. And it would be easier to have it look like the most blogs, who have things like that on one line.
Sure, emails could be spammy, but you can also miss so many “LIKES” at older posts. It should be a function that you self can decide if you wants emails or not.
Can´t it work with IP-adresses and the name?
Many pepole uses the same computer when they read blogs, and with “Wp-user online”-plugin they can show who are online at the blog.
It´s read the visitors name and the ip adress and put them together. If there are visitors who doesent comment on the blog they are called by “Guest” and their IP.
Hey I was in my plugins and it wanted to upgrade and I did and it blew out on me Data ERRORs everywhere ..better check out your upgrade.
I had to disable it until you fix it.
Just installed 2.0.1 and it’s working great.
Here’s a couple of links to some plugins that track user activity within them. Maybe they can help you figure out how it’s done? Wish I could be more help than that, but I don’t know much about the coding of these things. :/
Keep up the good work!
Sorry for the comment spam. Forgot to actually mention the plugins.
Just search for ‘WP Polls’ and ‘WP PostRatings’ in the plugin directory. Both by Lester Chan. They both track and report user activity by name and IP.
On my website, if I click Unlike, the spinning .gif just endlessly spins. If I refresh the page, it does show that the post was unliked. But it didn’t spin forever before. I notice that on your page here, it doesn’t do that.
@ Local Landing.. thanks will take a look, I was digging into gravatar and how it worked.
@izdale, I see you modified the plugin javascript. change ‘$’ to ‘jQuery’ in the beginning of the wp_bought.unbought function.
@Pousche I need more details of the error to be able to help you more.
@Aakash – I didn’t modify the javascript, the only thing I modify is likes to bought, unlike to unbought, etc. I installed the plugin on my family blog as well, straight from wordpress with no modifications, and I have the same problem. I’m thinking that the plugin installed here on your blog is slightly different than the build available for download.
My plugin works perfectly fine.
Is there a way of removing the plugin from my pages (ie. contact, about me, etc.)?
@Nadiyah
There is a option for that under Settings->WP Likes in admin panel.
Uncheck- “Visible on posts on pages”
I was trying to set this script up and it seemed to install correctly. However, when I call it into my layout with the function it only shows the thumbs up and the like link with a border above and below. It does not show the blurb on your page. Also, when I click it loads the loading image but that’s it. It doesn’t do anything else. My blog is located in a beta/ folder like another commenter here. Could this affect it. I use a host which has the latest php so I’m not sure what’s going on. Thanks!!
Jeremy,
Is there any javascript error thrown in error console’s of firefox/chrome when you click like?
The plugin should provide some debugging information in the firebug console in firefox.
[...] Eklenti Ana Sayfası [...]
[...] Eklenti Ana Sayfası [...]
what bugs me though is that indeed there are cool variations (http://s.wordpress.org/extend/plugins/wp-likes/screenshot-2.png?r=167725) but I just can’t seem to find the stylesheet code for them.. :C looking for the second, girly one. :3
Well. its the customization done by users. Credit goes to them. I am not sure if they will allow you to use there images/icons. You can reach them out.. (most of them are commentors on this and other WP likes post).
You can always see the stylesheet by right click->view source and searching for ‘WP Likes CSS’
As far as that design is concerned I remember seeing it here- http://walldaisy.com/ ,another girly design- http://kristinamedh.us/
yup, thanks, by now it’s irrelevant anyway, I ended up writing my own CSS. I was just too lazy to customize it initially but soon I realized there’s no choice. (:
Hey Aakash–changed domain names (kristinamedh.us –> prettyshinysparkly.com).
For now, I have disabled the plugin because the CSS & JS is being inserted inline into every page that contains the plugin’s code (including the front page). Is there anyway the plugin can <link rel the stylesheet and <script type the Javascript rather than insert it into every page inline and garble up my markup? Just a suggestion. Otherwise, I love it! I have a fabulous implementation using hearts…will reactivate if we can get this inline thing fixed.
Hope the updating is going well!
@Kristina the reason for not making the CSS and javascript files external is that, it would result in 2 more HTTP requests for a small amount of data.
Also if there are n–plugins on the blog doing this, it may greatly hamper the page’s downloading speed and it may appear that the page is loading forever..
Ah, I see. Could there be an option in the future to copy/paste the WP likes CSS and add it to our own stylesheet, and disable the embedding of CSS by the plugin? That would, I presume, eliminate the problem. Just a thought!
Nice plugin, any way of preventing all the inline css / jquery being inserted in the header?
Also its fairly annoying that the plugin loads jquery (when 99% of people already have this in their header)
Cheers
@nick, the plugin will load jQuery only if its not being already loaded by some other plugin.
I am thinking of putting a option in next release to make the css, js
code external.
[...] URL: http://blog.aakash.me/index.php/2009/04/i-likes-this-and-so-does-wordpress/ [...]
Very nice
[...] WP Likes エントリーごとに「Like」リンクをつけて、ユーザが気に入ったかどうかがわかるようになるプラグイン/li> [...]
[...] wp likes —-> beğendim yorum tagları gösteren güzel bir eklenti [...]
[...] 16. wp likes [...]
Thank you.Very good plugin
Hi this theme is extremely interesting. Keep it going guy !