If You Liked That ~ plugin
Version 1.3 of the plugin is now available. This new version is compatible with WP 2.3 and takes on board many of the comments that I have received ~ keep the feedback coming.
You can download it from here.
I’m always looking for suggestions on I can improve things, any suggestions for amendments to If You Liked That will be gratefully received.
Please post any comments below…..
Posted in Wordpress |

June 14th, 2007 at 11:54 am
Dear Martin,
I like the plugin, simple and easy to install. It works great with posts but…
With pages it shows up like it should but when i click a suggested link i get an Wordpress database error.
I’m no expert so can a repair that with a reinstall,
Thanks Arno
June 15th, 2007 at 9:57 am
Sorry to hear that Arno,
If you email me you site details I’ll take a look!
June 17th, 2007 at 9:13 pm
It’s a great plugin - but when I try to limit the categories on which the plugin will be used, I get an error message in each post. How exactly am I supposed to type in the category names I want to omit? Should there be spaces after the commas, no spaces after commas, no spacing whatsoever, etc.? I really only want this to be used with FOUR of my categories rather than all 20-25. Other than that, it’s a great plugin that was easy to install!!
June 19th, 2007 at 12:14 pm
Jaynee, Glad you like it!
Sorry, it’s not very well labelled, you actually enter the category id number, so to exclude posts in categories two and eight you simply enter: 2,8
Should work for any number of categories. You can find out the category id number in your admin panel under Manage | Categories, first column to the left.
I’ll improve the labelling on the next version.
June 27th, 2007 at 10:48 am
Good idea, I’ve been looking for something like this, but for my sidebar… would it work in a widget form?
June 28th, 2007 at 9:54 am
Thanks kristarella , My new plugin What’s New What’s Fresh What’s Happening (out soon) will provide links from the sidebar (on any page WP and non-WP).
Must admit I’m not completely au fait with widgets … more reading up for me!
I think I can feel version 1.2 of If You Liked That coming…
July 5th, 2007 at 1:56 am
Hi! Great plugin, and it works very well!
But I wonder if it’s possible to choose where the list must appear.
I mean, I would to show the “if you liked that” stuff at the very end of the loop, even above the author, category, comment count, technorati tags, etc. and not just after the content.
It’s possible (maybe in future?) to do this?
Thanks!
July 5th, 2007 at 1:58 am
Ops… I intended to write “below”, instead of “above”
July 5th, 2007 at 12:40 pm
Thanks for the suggestion degra,
I be working on a new widgetised version of the plugin shortly, I’ll certainly add some new hooks that will allow selection of alternative places to place the list as well.
July 10th, 2007 at 1:14 am
Hi, I like your plugin and I have integrated it on my website.
The only two drawbacks I have found up till now is
1) It only searches for related posts in the same category. Maybe it would be an idea to put in an option so you can choose that it searches your whole blog instead of just the category the post is placed in?
2) There is no option (yet?) to choose to order the links according to relevance
Keep up the good work!
July 10th, 2007 at 10:50 am
Glad you like it Wouter …thanks for the feedback.
At the moment If You Liked That is a simple little plugin that merely selected posts from within the same category as the displayed post. I can certainly see the value of a plugin that provides the same functionality, but with a blog-wide search. I could then introduce concepts such as relevance & related sorting. Another one for the work-list.
July 10th, 2007 at 2:55 pm
Thanks for your prompt answer! I would be very glad to see you further develop the script because it’s the best one I have found up till now. Maybe another one for the work-list: I have deleted the date/time/writer information from the list. I did it by hand in the source code. It would be great to have this as a menu option too! Thanks again.
July 11th, 2007 at 7:14 am
I’m trying to change the color of the line that says “If you liked that…” — where would I do this?
Thanks! This plugin is great!
Bryan
July 11th, 2007 at 9:50 am
Thanks Bryan, glad you’re a fan
Easiest is to edit the style sheet (Presentation | Theme Editor | Style Sheet / style.css), add the style below:
Replace #xxxxxx with your selected colour.
July 12th, 2007 at 9:23 am
thanks, worked like a charm!
July 21st, 2007 at 4:00 pm
Thanks for that great plug in! I’ve been looking for something like this for ages.
It works perfectly, except for one thing… “The line: If you liked this,….” doesn’t show and I have no idea how to fix it. Any suggestions?
Thanks a lot in advance!
July 21st, 2007 at 7:03 pm
Fudge, probably something to do with the styles you have on your site, post here or email me a link to your site with the plugin running and I’ll take a look….
July 22nd, 2007 at 11:45 am
The plugin is running, you’ll find it right here on my blog. Thanks a lot for your help!!!
July 23rd, 2007 at 3:32 pm
Fudge – a styling problem similar to the one Bryan had above … Your <h3> elements are set to white so you can’t see the text (white on white).
Easiest is to edit the style sheet (Presentation | Theme Editor | Style Sheet / style.css) and add the style below:
#ifyoulikedthat h3
{
color: #xxxxxx;
}
…change #xxxxxx to your selected colour.
Good Luck!
July 27th, 2007 at 2:41 am
Thanks for your greate plugin.
But how can I do if I want to put the related links below the comment-box?
July 28th, 2007 at 9:26 am
Thanks for your great plugin.
I’ve found that we can change some code to put the related links anywhere we want.
Just add global variable $iylt_show inside the function if_you_like_that() and instead of returning $content .= $ifyoulikedthatHTML, we asign $iylt_show = $ifyoulikedthatHTML and return $content.
So, now we can put related links anywhere by put PHP code
July 29th, 2007 at 12:11 pm
Thanks for the tip rilwis
August 12th, 2007 at 12:37 am
Hello, It’s great plugin but can please anybody help me putting it below my commentbox? I don’t understand te eplanation of Rilwis..Thanks!
August 28th, 2007 at 11:00 pm
Stev, You need some knowledge of PHP to follow rilwis’s tip.
The new version of the plugin (out when I get a chance to write it) will provide more flexibility in placement and will not require code changes … out soon(ish)
September 1st, 2007 at 3:52 pm
Thanks for your reply. Hopefuly you will find some time…;-)
September 9th, 2007 at 7:17 am
Love the plugin - just what the site needed for that extra something
September 21st, 2007 at 11:51 am
Oops not sure what I did but by enabling the related post mod to work as well it now no longer displays If you like that on category pages but works fine on single posts.
Go figure
Lewis
September 25th, 2007 at 5:51 pm
I love your plugin. But I just upgraded to wordpress 2.3. And the plugin no longer works. Are you working on an update for your plugin?
September 27th, 2007 at 1:38 pm
Thanks for the feedback Dave, I’ll see what I can do to fix it.
September 27th, 2007 at 5:06 pm
hi bochgoch, i love your plugin, and my problem is same as Dave, “if you liked that” can’t work at WP 2.3. and the error info says that the 2.3 DB was del the “post2cat” table. hope it’s useful to you.
September 29th, 2007 at 11:40 am
This is positivly one of the best plugins.
Love the fact that I am using the wp-email plugin and when I post an article to my blog my subscribers receive the current posting along with at the bottom of the post via e-mail If You Liked That …
However I seem to have one problem .
Although I toggled Select if links are only posted on single post pages = Y when you go to a category page it still lists for every post in the category the If You Liked That …
is there a way to fix this ?
Sincerely,
Lewis
September 29th, 2007 at 11:49 pm
Lewis — I can’t quite replicate that problem, do you have an example I could look at?
October 1st, 2007 at 3:28 am
Please Fix it, i love it
October 1st, 2007 at 11:31 pm
Quick Fix for Wordpress version 2.3 only
The database changes for 2.3 are pretty murderous to this plugin. I’ve got a new version of the plugin on its way in a couple of days, in the meantime, a quick fix!
Open if_you_liked_that.php and find the line of code:
$ifYouLikedThats = $wpdb->get_results("SELECT t1.ID, t1.post_title, t1.post_date, t1.post_content, t3.display_name FROM $wpdb->posts t1, $wpdb->post2cat t2, $wpdb->users t3 WHERE t1.ID=t2.post_id AND t1.post_status = 'publish' AND t1.ID != ".$post->ID." AND t2.category_id IN (".$INcat.") AND t2.category_id NOT IN (".$excludeCategories.") AND t1.post_author = t3.ID ORDER BY ".$orderBy." LIMIT ".$numPosts);
…and replace it with:
$ifYouLikedThats = $wpdb->get_results("SELECT t1.ID, t1.post_title, t1.post_date, t1.post_content, t3.display_name FROM $wpdb->posts t1, $wpdb->term_taxonomy t2, $wpdb->term_relationships t4, $wpdb->users t3 WHERE t1.post_status = 'publish' AND t1.ID != ".$post->ID." AND t1.ID=t4.object_id AND t4.term_taxonomy_id = t2.term_taxonomy_id AND t2.taxonomy = 'category' AND t2.term_taxonomy_id IN (".$INcat.") AND t2.term_taxonomy_id NOT IN (".$excludeCategories.") AND t1.post_author = t3.ID ORDER BY ".$orderBy." LIMIT ".$numPosts);
New whistles and bells version out soon!
October 1st, 2007 at 11:42 pm
[…] Temporary fix for If You Liked That plugin running under 2.3 published ~ new version coming soon! […]
October 2nd, 2007 at 11:30 pm
You are the best. Thanks
October 4th, 2007 at 3:56 am
I try to make the change and it don’t work for me. I will wait for you new and improved version.
October 5th, 2007 at 11:05 pm
Hello, the temporary correction does not work for me. Wordpress shows the following error:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND t2.term_taxonomy_id NOT IN (-9999) AND t1.post_author = t3.ID ORDER BY ran’ at line 1]. Hope this will be useful.
Thanks
October 11th, 2007 at 11:43 pm
Thanks for all the kind words and feedback, it makes work on these plugins worthwhile. The new version 1.3 is available now! The link to the download page is at the top of this post.
October 13th, 2007 at 6:03 pm
Hi Bochgoh!
I’ve just downloaded and installed your plugin, and I’m pleased to see that you have added the option for positioning the output (as I’ve asked some time ago).
But in my blog it doesn’t show anything in both index page and single post page if I set the position to “embedded”.
Thanks
October 13th, 2007 at 8:05 pm
degra, it sounds like you haven’t provided an anchor for the embedded text. The embedded text relies on a piece of text or html within the post after which it will be appended. It’s easiest to place an HTML comment as the anchor within the body of the post, the default value when the plugin is installed is… <!–IYLT HERE–> place that in the post where you want the links to embed.
October 15th, 2007 at 2:26 pm
Ah… I’ve not understood this before… I’ve used the anchor, but not in the post…
So it works only in the post body and not in the entire loop?
Thank you for your answer!
October 15th, 2007 at 3:00 pm
degra, the embedded option works only in a post and not within the loop … stands to reason really - if you want your links embedded within a post you have to tell WP where to embed it as every post is different.
October 15th, 2007 at 4:36 pm
Hi Bochgoh!
Love this plugin! I had a minor booboo in the options menu and it didn’t work the first time, but I read carefully the instructions and it turned out I wrote the category name instead of the number only. I changed it and voila, it worked. Very good!
October 16th, 2007 at 6:48 pm
Same problem here. It would be great when it works in a loop. It”s almost impossible to ad this to every post.
November 5th, 2007 at 11:26 am
Sorry my response has taken so long - been tied up with other things.
To address a general query…
The embedded option is only for use in very specific circumstances … if you don’t want to edit or insert the anchor into every post, then use the before, after or widget options.
November 6th, 2007 at 7:53 am
[…] If You Liked That ~ plugin - Following the content of a post, this plugin inserts links to a user selectable number of other posts in the same category as the main post. By bochgoch […]
November 26th, 2007 at 9:49 pm
Hi,
Looks like this is exactly what I needed but is it possible it does not work with all themes ?
Installed and activated it on my wordpress 2.23 version but it never appears .
Is this related to the specific theme I am using ?
Best,
Lewis
November 28th, 2007 at 2:46 pm
Lewis, are you running as a widget - you need to make sure that the sidebar (or whereever) that the widget is placed runs after the loop. That usually means placing the widget in a right sided sidebar or the footer.
Let me know the theme and site and I’ll take a look…
November 30th, 2007 at 5:09 am
Hi Bochgoch,
thanx for a great/easy/fast plugin. Just wanna ask something about “sentence” thing. When i post an entry that begins with an image, plugin shows only a “.” for first sentence. So what about two sentences? or three? im not a php guru so i couldn’t find it. if there is a solution i will be glad to see.. Thatz all. Thanx again for a good plugin.
cheers..
November 30th, 2007 at 5:10 am
Cheers - That is a problem, I’ll rework the whole sentence logic shortly.
November 30th, 2007 at 5:24 am
I love the plugin… only thing is, that there’s this gigantic gap between the title of ‘if you liked that…’ and the random posts that follow. yours doesn’t seem to have a gap, is there any way of fixing this?
November 30th, 2007 at 10:56 am
Thanks Lon,
A bit of css trickery is required to remove the gap, you’ll need to amend the #ifyoulikedthat h3 style. Easiest is to edit the style sheet (Presentation | Theme Editor | Style Sheet / style.css) and add a style similar to below:
December 15th, 2007 at 5:31 pm
Hello Bochgoch,
Excellent plugin. Just what I needed. Two questions:
1: On the basis of which criteria are related posts selected?
2: How can I alter the exact make-up of the message? The h3 works fine, but the body text and links (such as on http://www.eclectro.nl/2007-09-09-tecktonic-dance/) look different (other font, other size).
3: There’s unnecessary space between the last link and the rest of the footer. How can I remove this?
Thanks in advance!
December 18th, 2007 at 7:46 pm
Inge,
1. Just by category at the moment - I’ll work on a new version when I get a chance that works with WP’s new taxonomy stuff.
2 & 3. CSS is the way to get a consistent look - the structure is basically:
<div id=”ifyoulikedthat”>
<h3>Your Title</h3>
<p><a href=”#” rel=”nofollow”>Selected Link</a></p>
</div>
…style those elements to your hearts content
There are a few examples above. You’ll need CSS to style …
December 23rd, 2007 at 12:19 am
Hello,
I put your website in my WP-blog but there is a strange behaviuor.
In the index of the website I see the related items (Articoli correlati, in Italian).
How I can fix it? I put the code
only in single.php but I see in index too.Thank you for your help
December 24th, 2007 at 7:40 pm
Rene, No need to amend any code as IYLT works with Wordpress hooks to insert itself into your blog. I suggest you use the After the post and Show links only on single post pages options to stop the links appearing on the index page.
December 27th, 2007 at 7:18 pm
It seems to have disappeared. I first started by embedding it and then changed it to the “after the post” and now its no longer there. I have uninstalled it and reinstalled to see if that was the problem. Do I need to write something on the single.php?
December 27th, 2007 at 7:35 pm
Bob, not sure what the problem is - I’ve tried accessing your blog but it’s not loading - no need to change single.php…
December 27th, 2007 at 8:33 pm
@ bochgoch: thanks for your elaborate reply. Nevertheless I’ve already switched to another plugin ([edit ~ a little cheeky inge posting a link to another plugin :)]), since it gives better related results. Good luck with your own!
December 27th, 2007 at 8:44 pm
Thanks…I am thinking it has something to do with me changing Categories to Tags on WP. I have went back to add tags to a few of them and they appeared. Thank you.
December 31st, 2007 at 8:43 pm
[…] um plugin que usasse as categorias do blog como critério de exibição e não deu outra, o “If You Liked That” do Bochgoch Blog é perfeito, simples de tudo, tanto de instalar como de […]
January 6th, 2008 at 3:00 am
[…] If You Like That […]
January 11th, 2008 at 9:48 pm
I’m using WordPress 2.3.2 with K2; I’d like to make the “If you liked that” font smaller and adjust the spacing between the links as well. I’ve looked through all the comments above and tried entering the code you recommend into my style.css but it’s not changing anything! Any insight would be greatly appreciated! Love your work…
February 13th, 2008 at 12:59 am
Hi bochgoch,
Just implemented your plugin. I figured somebody had to have made a plugin like this one. As a future feature, I’d suggest a ‘limit’ functionality (like i’ve read here). I tried limiting the categopries, but that didn’t work as expected: those categories got left out. Which is also a good feature, ofcourse
.
I also edited your plugin to display 100 charcters and stop at the first space, instead of your method. Since most of my posts contain an image at the start, no first line was shown. I changed
$postSentence = ''.strip_tags($pieces[0]).'.';to read this:
$postSentence = ''.substr(strip_tags($ifYouLikedThat->post_content),0,strpos(strip_tags($ifYouLikedThat->post_content),' ',100)).'...';Besides that, I cut out the style and tried matching it with my current theme.
Really love what you did, clean and easy plugin. Customizing it just took me 10 minutes. Thanks!
March 30th, 2008 at 2:09 pm
Have been using this great plugin for almost half a year by now; and would like to see the update for the following:
1. Automatic detection of the posts in the same categories and parts of the titles
2. An option to also include the some description from the posts with words limitation
3. An option to also assign to open the links in a new widows/tap
4. An option to style the texts.
Waiting forwards to seeing your update soon.
Thx
March 31st, 2008 at 5:26 pm
It would be great if you can also add more features: Show posts in the same category, similar title, tag. And custom field to also add a link to it.
Thx
March 31st, 2008 at 5:27 pm
Opp one more thing, your this plug-in conflict with this:
http://pixelplexus.co.za/blog/2007/11/20/plugin-to-change-wordpress-post-order/
Please, kindly check it out.
May 4th, 2008 at 11:22 pm
Hi,
At the moment it dispaly automatically just after the post text. I want to display at the end of my post as per my choice. Is it possible to define a place in template( single.php)
Thanks
Shobhit