Yet Another Related Posts Plugin

Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal

by mitcho (Michael 芳貴 Erlewine) for WordPress.

NEWS: WordPress founder Matt Mullenweg recommends YARPP as one of his favorite plugins on Tekzilla.

Yet Another Related Posts Plugin 3.0.6 with caching and templates
Read this tutorial on the new templating features.
166 kb - zip

Description | Installation | FAQ | Localizations | Versions | Support forum

relatedposts algorithm display disallowed disallowed

Description

Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages related to the current entry, introducing the reader to other relevant content on your site. Key features include:

  1. An advanced and versatile algorithm: Using a customizable algorithm considering post titles, content, tags, and categories, YARPP calculates a "match score" for each pair of posts on your blog. You choose the threshold limit for relevance and you get more related posts if there are more related posts and less if there are less.
  2. Templating: New in 3.0! A new templating system puts you in charge of how your posts are displayed.
  3. Caching: New in 3.0! YARPP now caches the related posts for all the posts and thus has significantly improved performance over versions 2.x.
  4. Related posts in RSS feeds: Display related posts in your RSS and Atom feeds with custom display options.
  5. Disallowing certain tags or categories: You can choose certain tags or categories as disallowed, meaning any page or post with such tags or categories will not be served up by the plugin.
  6. Related posts and pages: Puts you in control of pulling up related posts, pages, or both.

Installation

Auto display on your website

  1. Copy the folder yet-another-related-posts-plugin into the directory wp-content/plugins/ and (optionally) the sample templates inside yarpp-templates folder into your active theme.

  2. Activate the plugin.

  3. Find the Related Posts (YARPP) settings page in your wp-admin. If you see a message telling you to build your cache, please build your cache. Otherwise, you will see no related posts anywhere.

NOTE: If you run a large and complex site and/or worry about your SQL query volume, it may be better to simply make sure the "compute related posts on the fly" option is turned on and not try to build the cache all at once.

Auto display in your feeds

Make sure the "display related posts in feeds" option is turned on if you would like to show related posts in your RSS and Atom feeds. The "display related posts in feeds" option can be used regardless of whether you auto display them on your website (and vice versa).

Widget

Related posts can also be displayed as a widget. Go to the Design > Widgets options page and add the Related Posts widget. The widget will only be displayed on single entry (permalink) pages. The widget can be used even if the "auto display" option is turned off.

Custom display through templates

New in version 3.0, YARPP allows the advanced user with knowledge of PHP to customize the display of related posts using a templating mechanism. More information is available in this tutorial.

Manual installation

For advanced users with knowledge of PHP, there is also an advanced manual installation option.

Frequently Asked Questions

If your question isn't here, ask your own question at the Wordpress.org forums.

Every page just says "no related posts"! What's up with that?

  1. Most likely you have "no related posts" right now as the default "match threshold" is too high. Here's what I recommend to find an appropriate match threshold: first, lower your match threshold in the YARPP prefs to something ridiculously low, like 1 or 0.5. Most likely the really low threshold will pull up many posts that aren't actually related (false positives), so look at some of your posts' related posts and their match scores. This will help you find an appropriate threshold. You want it lower than what you have now, but high enough so it doesn't have many false positives.

  2. It is also possible that your related posts cache has not been built and the "compute related posts on the fly" option is also turned off. Please go to the Related Posts (YARPP) options page and either build the cache or turn on the "compute related posts on the fly" option.

How do I turn off the match score next to the related posts?

The match score display is only for administrators... you can log out of wp-admin and check out the post again and you will see that the score is gone.

If you would like more flexibility in changing the display of your related posts, please see the templating tutorial.

Does YARPP work with full-width characters or languages that don't use spaces between words?

YARPP works fine with full-width (double-byte) characters, assuming your WordPress database is set up with Unicode support. 99% of the time, if you're able to write blog posts with full-width characters and they're displayed correctly, YARPP will work on your blog.

However, YARPP does have difficulty with languages that don't place spaces between words (Chinese, Japanese, etc.). For these languages, the "consider body" and "consider titles" options in the "Relatedness options" may not be very helpful. Using only tags and categories may work better for these languages.

Does YARPP slow down my blog/server?

A little bit, yes. Every time you display a post with automatic display of related posts (or one of the related_*() functions) it will calculate the related posts, which can be a database-intensive operation. I highly recommend all YARPP users use a page-caching plugin, such as WP-SuperCache. For the majority of users, this type of caching will be enough to stem the performance issues.

If you have a large blog with many (>1000) posts or have many tags or categories, YARPP may noticibly affect your blog's performance, even with a caching plugin. For these large blogs, for the time being I recommend you disable the "consider tags" and "consider categories" options. Turning off any "disallow" tags or categories will also speed things up.

In the future I will be building a YARPP-internal cache system so that YARPP can calculate all the post-relations at one time and then re-use those results every time, rather than calculating them on the fly.

I use DISQUS for comments. I can't access the YARPP options page!

The DISQUS plugin loads some JavaScript voodoo which is interacting in weird ways with the AJAX in YARPP's options page. You can fix this by going to the DISQUS plugin advanced settings and turning on the "Check this if you have a problem with comment counts not showing on permalinks" option.

I get a PHP error saying "Cannot redeclare related_posts()"

You most likely have another related posts plugin activated at the same time. Please disactivate those other plugins first before using YARPP.

I turned off one of the relatedness criteria (titles, bodies, tags, or categories) and now every page says "no related posts"!

This has to do with the way the "match score" is computed. Every entry's match score is the weighted sum of its title-score, body-score, tag-score, and category-score. If you turn off one of the relatedness criteria, you will no doubt have to lower your match threshold to get the same number of related entries to show up. Alternatively, you can consider one of the other criteria "with extra weight".

It is recommended that you tweak your match threshold whenever you make changes to the "makeup" of your match score (i.e., the settings for the titles, bodies, tags, and categories items).

XXX plugin stopped working after I installed YARPP!

Please submit such bugs by starting a new thread on the Wordpress.org forums. I check the forums regularly and will try to release a quick bugfix.

Things are weird after I upgraded.

I highly recommend you disactivate YARPP, replace it with the new one, and then reactivate it. If you continue to have trouble, please find

Localizations

YARPP is currently localized in the following languages:

We already have localizers lined up for the following languages:

If you are a bilingual speaker of English and another language and an avid user of YARPP, I would love to talk to you about localizing YARPP! Localizing YARPP can be pretty easy using the Codestyling Localization plugin. Please contact me first before translating to make sure noone else is working on your language. Thanks!

© 2006-2009 mitcho (Michael 芳貴 Erlewine).

The views expressed on these pages are mine alone and do not
reflect those of my employers and clients, past and present.