Artikel vom 16. Oktober 2008

Related Posts by Category: The WordPress Plugin for Similar Posts

Favorit

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 do_action(
    'related_posts_by_category',
    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.6 dated 08.05.2010:

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.

Social Werkzeuge

42 Kommentare zum Artikel

653 Tage zuvor | #1 Tal galili

you rock rock rock !

Tal galili
615 Tage zuvor | #2 Jeff

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

Jeff
614 Tage zuvor | #3 Sergej Müller

Hi Jeff.

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

Sergej
614 Tage zuvor | #4 Jeff

It seems to work in the PHP exec widget

Jeff
605 Tage zuvor | #5 leverpostei

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.

leverpostei
605 Tage zuvor | #6 Sergej Müller

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

Sergej
603 Tage zuvor | #7 Jeff

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.

Jeff
603 Tage zuvor | #8 Jeff

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.

Jeff
603 Tage zuvor | #9 Sergej Müller

I look at this.

Sergej
595 Tage zuvor | #10 Hubert

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

Hubert
503 Tage zuvor | #11 Bülent Sakarya

parametres for category id??

Bülent Sakarya
463 Tage zuvor | #12 Steven

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?

Steven
459 Tage zuvor | #13 nash

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

Thanks

nash
438 Tage zuvor | #14 ste

great plugin

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

thanks

ste
438 Tage zuvor | #15 Alf

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

Alf
430 Tage zuvor | #16 Tcmo6

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!

Tcmo6
430 Tage zuvor | #17 Sergej Müller

@Tcmo6
I implement your request in the next update.

Sergej
430 Tage zuvor | #18 Tcmo6

Thanks man. i am waiting for that.

Tcmo6
423 Tage zuvor | #19 kevin

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

kevin
414 Tage zuvor | #20 Dylan

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

Dylan
380 Tage zuvor | #21 claire

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

claire
376 Tage zuvor | #22 David

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.

David
363 Tage zuvor | #23 nick

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!

nick
361 Tage zuvor | #24 Mengembalikan jati diri bangsa

Great plugin. big thanks to Sergej Müller

Mengembalikan jati diri bangsa
351 Tage zuvor | #25 Jesse

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

Jesse
342 Tage zuvor | #26 Matteo

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

Thank you

Matteo
342 Tage zuvor | #27 Sergej Müller

Yes, in comming version.

Sergej
342 Tage zuvor | #28 Matteo

Ok, thank you for immediate reply !

Matteo
320 Tage zuvor | #29 eCommerce News

Hi,

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

eCommerce News
276 Tage zuvor | #30 Vrankey

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!

Vrankey
271 Tage zuvor | #31 sam

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

sam
263 Tage zuvor | #32 mrtiti

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

mrtiti
262 Tage zuvor | #33 Rocky

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

Rocky
261 Tage zuvor | #34 Meissen

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

Gruss

Meissen
223 Tage zuvor | #35 Valerian

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

Valerian
223 Tage zuvor | #36 Sergej Müller

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
215 Tage zuvor | #37 elena

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

elena
215 Tage zuvor | #38 Sergej Müller

@elena
Not yet feasible. Must be first programmed.

Sergej
213 Tage zuvor | #39 rhythm

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

rhythm
212 Tage zuvor | #40 Ivan

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

Ivan
212 Tage zuvor | #41 Ivan

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

Happy New Year!

Ivan
210 Tage zuvor | #42 shoaib

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

shoaib

3 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