Artikel vom 16. Oktober 2008

Related Posts by Category: The WordPress Plugin for Similar Posts

For on one of my favorite projects, das junge Magazin für Apple, I was looking for a Wordpress plugin, which could find relevant articles and list them in order. Actually, I did not ask for much: Extreme performance, no extra storage capacities, and no fulltext search within the database. However I did not find any candidates. So I developed: Related Posts by Category for WordPress.

 
 
German Version
Related Posts by Category: Plugin für verwandte Beiträge einer Kategorie

Category as criteria for relevance
The WordPress plugin Related Posts by Category lists similar posts within any post. As a search string the plugin does not use the title of the article nor weighs the content. In fact the category, which was assigned to the post, serves as the source of accordance. The reason for that: Posts from an equivalent category have most of the time identical topics and can therefore be seen as absolute relevant. Is an article assigned to more than one category, all of those categories will be used for the database query. Obviously this leads to more results.

Jump labels

Features

Mode of operation
After calling the following php function with justified parameters (possible data beneath) out of the template, the activated plugin shows a list of related posts:

<ul>
<?php if (class_exists('RPBC')) {
  new RPBC(
    array(
      'orderby' => 'post_date',
      'order' => 'DESC',
      'limit' => 5,
      'echo' => true,
      'before' => '<li>',
      'inside' => '&raquo; ',
      'outside' => '',
      'after' => '</li>',
      'rel' => 'nofollow',
      'type' => 'post',
      'image' => array(50, 50),
      'message' => 'no matches'
    )
  );
} ?>
</ul>

Possible data explained in detail:

Example
A n example with similar articles to this post is found beneath, between the actual post and comments.

Version progress
Version 0.5 dated 16.12.2009:

Version 0.4 dated 08.11.2009:

Version 0.3 dated 08.07.2008:

Version 0.2 dated 07.05.2008:

Version 0.1 dated 15.02.2008:

Installation

Download
› WordPress Plugin Related Posts by Category ↓

Sergej Müller

[Der Autor] Sergej Müller ist enthusiastischer Software Engineer mit Schwerpunkten Webentwicklung und WordPress. Seit 2007 programmiert und vertreibt er wpSEO, das weltberühmte und patentierte SEO-Plugin für WordPress-Blogs.

42 Kommentare zum Artikel

#1 Tal galili am 16. Oktober 2008 um 13:38

you rock rock rock !

#2 Jeff am 23. November 2008 um 19:23

this looks great. Two questions:
1. Can this be used in the php widget sidebar?
2. Can you specify that you want to show posts from only the current category?
thanks

#3 Sergej Müller am 24. November 2008 um 14:57

Hi Jeff.

1. I must first test.
2. If a post appears, it will automatically use the current category.

Sergej Müller
#4 Jeff am 24. November 2008 um 19:47

It seems to work in the PHP exec widget

#5 leverpostei am 3. Dezember 2008 um 03:10

Is it possible to display image links instead of text links with this plugin?
My website is very image oriented so it would be much handier if I could somehow display the first image of the post instead of a text link.

#6 Sergej Müller am 3. Dezember 2008 um 09:22

leverpostei, not yet, I write it for me later.

Sergej Müller
#7 Jeff am 5. Dezember 2008 um 04:46

When I use this with the PHP exec widget, it does not output the properly nested

link

structure. It is missing the and . The plugin is fairly easy to add those in, but I thought I would update you. Thanks.

#8 Jeff am 5. Dezember 2008 um 04:48

The form stripped out the email. What I meant to say was that using the php exec widget, the plugin doesn’t add the nested “ul” tags for the list.

#9 Sergej Müller am 5. Dezember 2008 um 09:12

I look at this.

Sergej Müller
#10 Hubert am 13. Dezember 2008 um 18:33

Thanks very much for this wonderful plugin. Love the options.

#11 Bülent Sakarya am 15. März 2009 um 18:43

parametres for category id??

#12 Steven am 23. April 2009 um 23:18

Very nice plugin! But I also want to show the post that’s allready showing. Just so that it is in the list. Too bad this only shows related posts and not the post itself.

Is there a way to to this?

#13 nash am 28. April 2009 um 18:22

hello,
I could not find the file single.php
can you tell me where this file is. I’m using guru-theme

Thanks

#14 ste am 19. Mai 2009 um 08:49

great plugin

how do you change the font size and put a title for the related posts?

thanks

#15 Alf am 19. Mai 2009 um 21:20

Hi, I have a blog about music, therefore my posts are all cateogorized, but they all differ from one another.

I mean, under the category “Jazz” “Pop” “Rock”, all posts talk about jazz, pop, rock,… but about different records and artists.

I would like the plugin to do what its name says: related posts by category, no matter what they talk about. If a person comes to my website using a search engine, chances are that the other post in the same category may interest them as well…

Could this be achieved with this plugin or should I look somewhere else? (I’ve installed it and no related posts show)

Regards and thanks for your time and effort

Alf

#16 Tcmo6 am 27. Mai 2009 um 16:29

How to display the last posts from the parent category. For example:
I have the main category Sports with subcategory: tennis, footbal, basketball, etc
If my last article in category Sports is asigned to subcategory Tennis, then the plugin will show my last 5(or any other number of posts) from Tennis category.
All i want is that the plugin to show my last 5 from the parent category: Sports and not to show my last 5 from tennis.
How to make this?
You can see the plugin in action here: http://www.shtiri.ro
Thanks in advance!

#17 Sergej Müller am 27. Mai 2009 um 20:05

@Tcmo6
I implement your request in the next update.

Sergej Müller
#18 Tcmo6 am 27. Mai 2009 um 20:09

Thanks man. i am waiting for that.

#19 kevin am 3. Juni 2009 um 01:21

Will you be adding exclude?, the ability to remove a list of cats would be great.

#20 Dylan am 12. Juni 2009 um 11:37

Great idea – I was just looking for this functionality. I have already added to two websites.

I have tested in a couple of categories, it was working fine. But today, I noticed, it also list posts from categories other than the current one.

The posts that is being listed under a different category looks to have some relation with the current category – either it contains the exact current category keyword(description of the category) as part of the content or as a tag. (Each post only belongs to one category)

I was going to add the plugin to more sites but will wait now if it could be solved. Hope you can have a look to this problem.

Thanks

#21 claire am 16. Juli 2009 um 10:23

Related posts by category shown in random order is exactly what I’m looking for my blog. Thanks a lot!! =)

#22 David am 20. Juli 2009 um 06:31

I use my wordpress to build my online store where I sell my hand knit hats (made by me) and I was looking for a plugin that could display a link to all of the items in my shop on each single page article. I easily accomplished this with your plugin simply by adding a new category (made by david) and assigning that to each item in my shop. I now have a convenient list of all items listed on each page thanks to your plugin. Thank you so much for creating it.

#23 nick am 2. August 2009 um 12:15

Fantastic plug-in, thank you very much!

I just have one query. I am using private posts on my site, do you have any idea on how I would modify the plug-in so that it finds and displays these posts to authorised users? Currently the plug-in doesn’t seem to recognise any private posts. I’ve found the following links which I thought would help, but I’ve still not been able to get it to work with the plug-in…
http://codex.wordpress.org/Function_Reference/wp_count_posts
http://wordpress.org/support/topic/211626

Many thanks!

#24 Mengembalikan jati diri bangsa am 4. August 2009 um 15:48

Great plugin. big thanks to Sergej Müller

#25 Jesse am 14. August 2009 um 01:56

Hi,
Can you add one title option to this awesome plugin. for example,
You’d like to see (the title I want)
blah blah blah

#26 Matteo am 23. August 2009 um 17:08

How can I do to include thumbnail image for each link ?

Thank you

#27 Sergej Müller am 23. August 2009 um 17:10

Yes, in comming version.

Sergej Müller
#28 Matteo am 23. August 2009 um 17:28

Ok, thank you for immediate reply !

#29 eCommerce News am 14. September 2009 um 12:08

Hi,

It works great, i got a lot more pageviews after installed

#30 Vrankey am 28. Oktober 2009 um 09:13

Great plugin! Thank you so far! :)

My goal is to include only posts that are older than the current, so internal linking would work static. Currently even old articles show links to the newests posts.

Is it possible to configure this? Or is an update in work? I think it would very great if that was possible!

#31 sam am 2. November 2009 um 07:52

hi–can you use this for displaying posts from categories bound to the current user: i.e how would you factor in a user_id where that is tied to a particulapr post and display only those posts relevant to the current user?

thks

Sam

#32 mrtiti am 10. November 2009 um 11:23

great plugin
Im trying to add it to the sidebar is it possible ?
i want it to include excerpts & content of the posts
tnx a lot

#33 Rocky am 11. November 2009 um 02:26

Hello,

First and foremost this is an excellent idea! I love the concept. I am however not able to get it working! I’d like to have it work in my right hand sidebar and have not certain exactly which code to put. The long list starting with UL or the single line of PHP mentioned above. And in the “single.php” file, I’m not sure where to put it.

Any assistance is appreciated!

Thank you,
Rocky

#34 Meissen am 12. November 2009 um 15:21

Super Plugin, vielen Dank dafür. :-)

Gruss

#35 Valerian am 20. Dezember 2009 um 14:59

How should I make this plugin active ? I activated is, but it isn´t working…

#36 Sergej Müller am 20. Dezember 2009 um 18:10

Please put <?php new RPBC(array(params)) ?> in your single.php template for display a list of similar posts. See “Mode of operation” below.

Sergej Müller
#37 elena am 27. Dezember 2009 um 23:21

Hi,
I really like this plugin, it’s the best one for related posts, but is there a way to add also the posts’ date near their titles?
Thanks in advance

#38 Sergej Müller am 28. Dezember 2009 um 09:43

@elena
Not yet feasible. Must be first programmed.

Sergej Müller
#39 rhythm am 30. Dezember 2009 um 21:11

I copied the HTML above (
‘post_date’,
‘order’ => ‘DESC’,
‘limit’ => 5,
‘echo’ => true,
‘before’ => ”,
‘inside’ => ‘» ‘,
‘outside’ => ”,
‘after’ => ”,
‘rel’ => ‘nofollow’,
‘type’ => ‘post’,
‘image’ => array(50, 50),
‘message’ => ‘no matches’
)
);
} ?>

into my single posts.php. It does make recent posts show up, but with no title like “Check out these recent posts” and the thumbnail images & text are hard left justified with tiny text and tiny bullet points. How do you add a title, increase the small text, and maybe center the whole list?
into my

#40 Ivan am 31. Dezember 2009 um 05:57

Hi Sergej, thanks for this plugin.

My question is : why is my site displaying a double style type?
One is the » and the other is a dark circle.
I hope you don’t mind to check my website, the url is in my comment’s website field

#41 Ivan am 31. Dezember 2009 um 06:00

Nevermind I got it work by adding this in css = ul {list-style:none;}

Happy New Year!

#42 shoaib am 2. Januar 2010 um 12:20

works perfectly with my theme ,thnx for this and please make more plugin like these!!

6 Verlinkungen auf den Artikel

› New Related Posts by Category WordPress Plugin | WordPress Hacks

› Ultimate Collection of WordPress Plugins

› Membuat Related Post Wordpress Tanpa Plugin : Blog SEO

› Membuat Related Post Wordpress Tanpa Plugin | GoBLogKE - Create [...]

› hellblau ist das neue schwarz – smash

› Cara Menampilkan Related Post berdasarkan Kategori | I [...]