Now Listening…

PhotoLegal Podcast No. 5 – US Special (Update: Fixed Audio)” performed by PhotoLegal

Nice Related Posts plugin

This is a WordPress plugin tweaked from wordpress related entries plugin, it also uses portions of the nice categories plugin to list the related posts - comma separated with 'and' before the last in the same whay that nice categories does with categories.

Example:

Welcome Marshmallow, Marshmallow theme maybe?, to theme or not to theme?, Pompey FC T610 Theme and Milk Theme for T610.

Download plugin code (ZIP file) - should be ok hopefully, but please leave any comments and Ill tweak the code if necessary.

*EDIT:* Ok, code. place
?php nice_related_posts(); ?> >
where you want the list.

you can customise it thusly
nice_related_posts($limit=5, $normal_separator = ', ', $penultimate_separator = ' and ', $show_pass_post =false)
$limit is the amount of post to be listed (default is 5), normal_separator whatevers between the posts (default is ',' or comma), penultimate_separator is what appears between the last and penultimate post (defaults to 'and'), show_pass_post is whether or not to show passworded posts.

*For example*
?php nice_related_posts(3, ' or ', ' and finally ', false); ?> >
would result in

post 1 or post 2 and finally post 2

hopefully that helps, but WP mangles code tags so sorry if theres some confusion


28 Responses to Nice Related Posts plugin

  1. 8712 Tim 2005-03-12 01:08:45

    I get this error:

    Fatal error: Call to undefined function: nice_related_posts() in /home/smallbus/public_html/wp-content/themes/default/single.php on line 14

  2. 8713 Matthew 2005-03-12 11:46:05

    drop it into wp-content/plugins and then activate it from the plugins pane in your WP admin.

  3. 8814 ddman 2005-04-05 23:25:14

    Dropped the file in, activated, and added:

    to comments.php in my theme... I am getting the following error followed by a bunch of SQL...

    WordPress database error: [Can't find FULLTEXT index matching the column list]

  4. 8815 ddman 2005-04-05 23:25:57
  5. 8816 ddman 2005-04-05 23:26:34

    php nice_related_posts($limit=5, $normal_separator = ', ', $penultimate_separator = ' and ', $show_pass_post =false);

    Hopefully this will work :)

  6. 8817 Matthew 2005-04-05 23:28:18

    Id like to be more helpful, but Im afraid I cannot. I have no idea how the plugin works on a technical level, mine is just a tweak from this one, as explained above.

    Id suggest trying that and seeing if you get the same problem.

  7. 8818 Matthew 2005-04-05 23:29:27

    yes, WP doesnt generally like code tags :-(

  8. 8819 ddman 2005-04-05 23:47:39

    I think the error has to do something with indexing? I don't understand why it wouldn't work. Are you running it with WP 1.5??

  9. 8820 Matthew 2005-04-05 23:51:04

    Yup, my blog is 1.5

  10. 8821 ddman 2005-04-05 23:51:39

    This needs to be run prior to using the plugin...

    ALTER TABLE `wp_posts` ADD FULLTEXT `post_related` (
    `post_name` ,
    `post_content`
    )

  11. 8822 ddman 2005-04-05 23:52:06

    I'm up and running, that is just a one time thing... Thanks for your help!!!

  12. 8823 ddman 2005-04-05 23:53:04

    Out of curiousity, did you modify version 1.3.3 of the plugin or a prior version?

  13. 8824 Matthew 2005-04-05 23:58:50

    I think it was the earlier version by the looks of things. Maybe I should release an update .. although it does mean trying to work out what I did to the original plugin again :-(

  14. 8825 ddman 2005-04-06 00:01:07

    Yeah, I've run into similar problems with plugins I am working on, perhaps if it is not too much trouble the original plugin writer can implement your code as it seems you have added the option to pass in parameters that make it a little more flexible...

    Just my two cents ;)

  15. 8826 Matthew 2005-04-06 00:08:25

    Thats a good idea, but I think mine is significantly different from the original and I think it might just be best to keep them separate.
    As ever with these things though, once theyre installed and running you never encounter problems like yours so it doesnt become something you notice yourself and so have to fix.
    Ill certainly look at the latest version of the original plugin though and see if I have hunt down my changes. ;-)

  16. 8827 ddman 2005-04-06 00:42:17

    Also is this weird?

    Post A lists as related posts, B, C, D.

    Post B says No related posts.
    Post C has 1 related post, but it's not post A, B, or D...

    weird???

  17. 9073 Billie 2005-05-31 17:22:04

    My nice related posts says "none" but all three posts are on the same topic.

    Question: my WordPress was installed at http://metroeveningnews (without WWW) and I'm wondering if perhaps the Related plugin is looking for With WWW? I ask this because another plugin (live calendar) is working at url without www but not with www.
    SHOULD I REINSTALL WORDPRESS AT WWW or do you think that has nothing to do with related not working? It installed successfully but isn't relating. thanks so much!

  18. 9074 Matthew 2005-05-31 18:25:12

    Im afraid I have _no idea_. sorry.

  19. 9393 yonky 2005-12-26 12:58:40

    this plugin is work in WP 2.0??

  20. 9585 Yukko 2006-03-07 18:43:48

    >this plugin is work in WP 2.0??
    Only

  21. 9699 Better WordPress Plugins at fybix.net …it could be worse… 2006-08-31 13:28:36

    [...] 1. Nice Related Post Plugin We all love and use the Related Post Plugin and now its been made a bit better with this tweak. What this tweak does is give a bit more options to your output. Now you can list the related post and have commas and the word ‘and’ before the last one to make the output a bit more reader friendly. via somefoolwitha.com. 2. Nicer Trackbacks What this does is change the look of your trackbacks. Instead of having your trackbacks look like this “[…] Trackback link […]” they come out looking “Trackback link” ‘eh. Pretty nice touch to any WordPress website in my opinion. Also, you should look into fixing the output of your trackback display by changing the style they come out in, and seperating them. All thanks to cre8d. [...]

  22. 9762 JP Mens 2006-11-29 10:16:21

    In order to avoid future posts showing up, I've added a date check:

    AND (post_status = 'publish' && ID != '$post->ID' && post_date

  23. 9840 Charles on… anything that comes along » A PHP/MySQL question - geeks only need apply: how to get a formatted date from an associative array 2007-03-17 22:34:26

    [...] The original I’m working with is the tweaked Nice Related Posts plugin for Wordpress, which I’m tweaking further. If you want, I can release the code, assuming I’m ever done. [...]

  24. 9828 Charles on… anything that comes along » Fire up the engine of serendipity: getting the database to mine the Long Tail of this blog automagically 2007-03-21 23:10:42

    [...] Turns out - yes. I think El Reg has moved on, and got the machines to do it, and now so have I. I’ve turned on a Wordpress plugin called “related posts” (actually, nice-related-posts, which I’ve tweaked, which is itself based on related-posts). [...]

  25. 9850 Better WordPress Plugins 2007-05-23 11:32:40

    [...] 1. Nice Related Post Plugin We all love and use the Related Post Plugin and now its been made a bit better with this tweak. What this tweak does is give a bit more options to your output. Now you can list the related post and have commas and the word ‘and’ before the last one to make the output a bit more reader friendly. via somefoolwitha.com. [...]

  26. 9899 gio 2007-09-04 17:51:36

    i get the same error as Tim

    Fatal error: Call to undefined function: nice_related_posts() in /home/welchs/public_html/wp-content/themes/default/single.php on line 14

  27. 9906 Some very useful WordPress plugins at somefoolwitha.com 2007-09-09 20:26:21

    [...] Horne has compiled a list of his 10 mission critical wordpress plugins which mentions my very own Nice Related Posts (a mod of another plugin). I gave a few of them a go: Wordpress Reports gives easy access to Google [...]

  28. 9909 KOCHWERKSTATT » Relativ, ich denke mal, unbekannte oder wenig genutzte WordPress Plugins 2007-09-24 21:16:51

    [...] Besucher, um sie auf weitere interessante Beiträge im eigenen Blog hinzuweisen. Mit dem Plugin Nice related posts kann man es etwas anders [...]