A Better Related Posts Plugin

There are many plugins that find related posts for WordPress, and I was happy to use one of them in the past. However, WordPress evolves. One of the biggest change was the addition of custom post types. They are very useful and I use them a lot for my own and for client sites. And this is where every related posts plugin I tested failed: They don't support custom post types.

While reviewing the code of several plugins I decided that the Right Thing would be to write a new plugin from scratch. And that's what I did. Key features:

  • Depends on PHP5 and MySQL5
  • Option to add related posts to the RSS feed
  • You can theme the output as you like
  • Use fulltext indexes for good performance
  • Does caching through post meta, this means zero additional database queries
  • Incremental scoring for sites with many posts
  • Find related posts, pages and custom post types
  • Use different configurations at the same time, useful for different post types
  • Internationalized, OO, hopefully well documented and readable
  • Score relationships by various MySQL relevance scores or term relationships

Use tags, categories or custom taxonomies

The readme.txt contains extensive documentation. It is possible to create completely custom views of related content, including post thumbnails, date, excerpts etc.

Downloads are available at WordPress.org.

WordPress plugin demos are disabled as I don't use WordPress on this site any more.

253 comments

  1. avatar
    wrote this comment on

    I've downloaded and activated this plugin but it's not showing up on my pages. Am I missing something??

  2. avatar
    wrote this comment on

    Well I figured out how to make it on the post BUT it's showing 8 queries in 0.0966 seconds, current offset 0 after the words Related Content. How do I get rid of that and the numbers after the related post link??

  3. avatar
    wrote this comment on

    You can turn this information off on the options page. It is only displayed to logged in admins, not all visitors.

  4. avatar
    wrote this comment on

    i've activated this plugin on WPMU and i get error :
    "There is no fulltext index for wp_1_posts.post_content"
    "There is no fulltext index for wp_1_posts.post_title"
    Am I missing something?

  5. avatar
    wrote this comment on

    Which MySQL version are you running? The fulltext index should be created at plugin activation, and IIRC the plugin checks for the indexes every time you access the options page.

  6. avatar
    wrote this comment on

    Oh, did you perform a network activation of the plugin? I guess that would trigger the error on all blogs but the one you activated the plugin on.

  7. avatar
    wrote this comment on

    If you did a network-wide activation please try again with the current trunk version: http://wordpress.org/extend/plugins/better-related/download/ (trunk should appear in a few minutes)

  8. avatar
    wrote this comment on

    thanks nicolas, I am very pleased and will patiently wait

  9. avatar
    wrote this comment on

    Btw, there's something wrong with the plugin repository. If you download the 0.4 release you'll really get the 0.4.1.2 release, which hopefully fixes your problem.

    I hope the repo will be fixed soon..

  10. avatar
    wrote this comment on

    Just getting started with this plugin and I need to know what values the multiplier fields take? is it just 0/1 or up to where? Need a bit more info on this...

  11. avatar
    wrote this comment on

    They are simply integers and there's no limit. Actually, I should probably make them floats...

  12. avatar
    wrote this comment on

    ok, thx. just wondering as by default two fields had 1 the rest had 0... will experiment a bit... I guess everyone has figure out his own values depending on what he uses most, categories/tags/etc..

  13. avatar
    wrote this comment on

    ok, now totally confused. I read above: The scoring methods... so it seems the multiplier fields are not used at the same time?
    Where do I select a scoring method?

  14. avatar
    wrote this comment on

    Each scoring method has it's own multiplier, that you can set on the options page. Setting it to 0 will disable that scoring method. Use the_related_analyze(); to analyze which scoring methods are relevant for you. Hide that from normal visitors on the frontend though, use current_user_can().

  15. avatar
    wrote this comment on

    I really don't understand. what do you mean relevant? I think all are relevant I just need to assign them a particular score depending on how goo the results they yield are? So if a particular scoring method gives me good results I raise its score, right? maybe lower or disable those that don't give good results and be happy with the resulting mix?
    btw. what are keywords? meta-keywords?

  16. avatar
    wrote this comment on

    I seem to be having some problems with the automatic injection into pages. the pages where I have hte problem, all have some sort of shortcode, either gallery shortcodes or other ones in them... it works for pages without shortcodes though. And I know there is related content because I used he_related_analyze(); to check it out...

  17. avatar
    wrote this comment on

    Please check the readme.txt. If things aren't clear there I will update the documentation.

  18. avatar
    wrote this comment on

    I have never seen this problem.

    Please disable or delete all plugins and switch to the default theme. The default theme in WordPress 3.0.x is Twenty Ten. After making these changes does the problem still occur?

    If not, switch the plugins on one by one and tell me which one creates the problem, I'll have a look.

  19. avatar
    wrote this comment on

    Ok, read the readme.txt. two questions remain:

    `= How to evaluate different scoring methods =

    Logged in admins can get the results of all scoring methods by using the template tag `` in the loop of their theme.`

    I don't think they are different scoring methods rather a mix of different scoring methods, right? I mean only if I give one method a value and 0 to all others have I decided upon a single scoring method, right?
    You say Local admins can get an overview of all scoring methods, what do other visitors see with the normal output? I think it is a mix of the multipliers I have set up in the back end, correct?

    `Keywords to content and keywords to title do a fulltext search for a string that contains all terms a post has. If a post is in the category Fruits and tagged sweet a fulltext search for "Fruits sweet" will be performed.`
    So keywords = tag in this case?

    `Terms against taxonomies searches for posts that have the same terms as the current one.`Terms = tag in this case?

    Sorry to be so insistent I jsut want to make sure I udnerstood it right :-)

  20. avatar
    wrote this comment on

    Please re-read the readme.txt. The analyze template tag has nothing to do with the normal related posts display.

    Yes, there are different scoring methods. I'm just releasing 4.2, please check the updated readme. The normal related posts list uses a mix (or not) of different scoring methods.

    No, "Fruits sweet" does not only contain tags in this case. Please check the readme.

    Tags are terms, categories are terms, any term in a custom taxonomy is a term.

  21. avatar
    wrote this comment on

    Hello, I got 2 posts in the same category. On the newer post the older one is under "Related Posts". But on the older posts the newer one doesn't appear. How do I make this work?

  22. avatar
    wrote this comment on

    Hi Patrick, you can lower the score necessary to display results or show more related posts. The relevance score varies, depending on which direction the relatedness tests are performed.

  23. avatar
    wrote this comment on

    Thanks for your advice. Lowered it to about 35 and it works now. :)

  24. avatar
    wrote this comment on

    Ok, great! I'm currently working on a new feature to set related posts manually as well. Hope to release it soon.

  25. avatar
    wrote this comment on

    hey, I am very glad to have found your plugin. it looks awfully useful, especially given all the fine tuning between post content, title, category and such!
    – my problem:
    I have included "" in my sidebar. while the plugin shows "related" posts under the single post, it at the same time says "no related" in the sidebar...
    ... can you help? thanks!

  26. avatar
    wrote this comment on

    PS: “” meaning the php-template-tag

  27. avatar
    wrote this comment on

    Hello! I tried to install this plugin using WP Admin and through FTP too, but It keeps showing:

    There is no fulltext index for wp_posts.post_content
    There is no fulltext index for wp_posts.post_title

    What can I do to fix it? Thanks!

  28. avatar
    wrote this comment on

    Hi oliver, I assume you meant the_related() ? You can pass the post ID as first parameter in the sidebar, that should work.

  29. avatar
    wrote this comment on

    Hi, I think this is a bug. I've just released 0.4.3 which should hopefully fix this problem. you need to deactivate the plugin and activate it again.

  30. avatar
    wrote this comment on

    This plug-in looks great !

    However I've got the same problem than ubas for my blog :
    http://windows-mobile.fr

    Could you help me please ?

    Best regards

  31. avatar
    wrote this comment on

    I've installed 0.4.3 (from scratch as I've just discovered your plug-in ;-) ) but I've got the same issue...

  32. avatar
    wrote this comment on

    Which MySQL version are you running? It has to be 5 at least.

    If you are on v5 try to run the command "CREATE FULLTEXT INDEX content_index ON wp_posts (post_content);" in phpmyadmin or another mysql client. Do you get an error, if yes which?

  33. avatar
    wrote this comment on

    Yes it's version 5.x :-)

    I'll try to do as you tell me but to be honest I'never used any mysql client until now... :shame:

  34. avatar
    wrote this comment on

    thanks for the feedback, Nicolas!
    – but this hasn´t changed the display.
    ...at least if you were meaning taking out the »get_the_ID(),« line of the call-function. still I get the "no related" in the sidebar, though results are there with the same code-lines [including the ID call] in the body...

    [on the sidetrack: still what the parameters of what I put in the sidebar actually do control is the display-behavior of the "automated display in post"-function if that setting is turned on... so there seems to be something going on in the background... :-}]

    PS: … what actually happens when I take out the ID-line, is that the sidebar display switches to the heading filled-in in the custom-presets section of the plugin (even though automatic display for posts is turned off there)

  35. avatar
    wrote this comment on

    Please keep in mind that I can't see your code, I don't really know what you are trying to do. It's probably filtered away because you used php tags.

    http://codex.wordpress.org/Function_Reference/get_the_ID : This tag must be within The Loop.

  36. avatar
    wrote this comment on

    thanks again! … I notice this bring me to the edge of my acpabilities, being a “user” rather than a “coder” :-}

    what I put in the post (where it works) as well as in the sidebar is code (php-tag?) taken from your instructions. it is a
    version of “the_related()”-function given there, to call up particular post-types:

    that is:

    [/php]
    the_related(
    get_the_ID(),
    array(
    ‘usept’ => array(
    ‘references’ => true
    ),
    ‘do_c2c’ => 1,
    ‘do_t2c’ => 1,
    ‘do_k2c’ => 1,
    ‘do_t2t’ => 1,
    ‘do_k2t’ => 1,
    ‘do_x2x’ => 1,
    ‘minscore’ => 50,
    ‘maxresults’ => 5,
    ‘log’ => true,
    ‘loglevel’ => ‘taxquery’,
    ‘storage_id’ => ‘better-related-reference-’,

    [... some more parameters unchanged from your example]

    ‘relatedtitle’ => ‘> associated references’,
    ‘relatednone’ => ‘no associated references’
    )
    );
    [end php]

    … so I guess, having “get_the_ID(),” in there, means “the tag is in the loop”?! or am I understanding things wrong?

  37. avatar
    wrote this comment on

    Save the ID while you're in the loop and use it in the sidebar. Like $postid = get_the_ID() in the loop and use $postid in your the_related() call.

  38. avatar
    wrote this comment on

    Hi Nicolas! I did the upgrade (deactivated and them the upgrade), but the error remains. I also tried the SQL do create the fulltext, but error again:

    Query : CREATE FULLTEXT INDEX content_index ON wp_posts (post_content)
    Error Code : 1214
    The used table type doesn't support FULLTEXT indexes

    What should a do now? Thanks

  39. avatar
    wrote this comment on

    Ah, I see. Your MySQL tables aren't using the MyISAM storage. Are you the database admin? If yes, it might be possible to change the storage engine, see <a href="http://dev.mysql.com/doc/refman/5.1/en/alter-table.html" rel="nofollow">this page</a>.

    MyISAM is the default storage engine for MySQL. I guess I could build engine detection into the plugin and create new tables if necessary... but this would create quite some overhead. I'll look into this for the next release, but at the moment I think it's rather unlikely I will add such a feature.

  40. avatar
    wrote this comment on

    I did the change, now It's MyISAM and the error n plugin's page disappeared, but all posts from my custom post_type "Eventos" keeps showing "No related content found."
    I'm using almost all the default configuration values, look: http://awesomescreenshot.com/09f3ksl22

  41. avatar
    wrote this comment on

    You could try to reduce the score necessary to display results. There's also the analyze template tag. Custom post types can have a much lower score than normal posts, depending on how they were coded. You could also switch to the transients storage engine just to test various settings.

  42. avatar
    wrote this comment on

    excellent plugin.

    however, how do i stop the current article being the first related post? i don't want users going round an endless loop.

    my current article always has a score of around 51000, and is always displayed as the first related post. all following articles are between 125 and 50 (my min score setting).

    i would like to list "other" related pages, and not say "you might like to read the article you're already reading. it's relevelant!" ;)

    thanks for your help.

  43. avatar
    wrote this comment on

    Hmmmm, that's odd. How is the list generated on your site? Do you just use the built-in auto-add feature? This shouldn't be happening.

  44. avatar
    wrote this comment on

    hello nicolas. thanks for the super quick response. i'm hard coding into my single.php (if that's what you mean). i’m using the_related() and it’s inside the loop.

  45. avatar
    wrote this comment on

    That shouldn't be happening. Did you maybe install an early version of the plugin? The SQL queries exclude the current post by now, but I'm not sure if I added that before the first release. You can simply change one of the multipliers in the scoring options, save, and change it back. That will clear the score cache.

    Actually, did you maybe edit the post after publishing it? I guess there could be a bug if I didn't verify the post status/revision or somesuch.

  46. avatar
    wrote this comment on

    i'm using wp 3.0.1 and used the "add new plugin" function to install your related content version 0.4.3

    i tried changing the multipliers. no luck. i did not edit the post after publishing. all current pages list themselves as the most relevant. sometimes ONLY listing themselves.

  47. avatar
    wrote this comment on

    Hey dave, I'm just uploading 0.4.3.2. This was a serious bug that didn't only affect pages. It is fixed now, thank you for reporting the problem!

  48. avatar
    wrote this comment on

    Tag to Taxonomy Multiplicator okay, but why not Category to Taxonomy Multi? If I got two posts with the tag "action" then they are linked. Fine. But if I got two posts of the same category (some posts have more than one cat, dont know if thats a problem) then they should also appear. They do not. Only if I go down to 10 % match and then it shows too much stuff.

  49. avatar
    wrote this comment on

    Yes, there's room for improvement for the term to term relationship scoring. I plan to work on that for the 0.5 release.

    It's "Term to taxonomy multiplier" btw, and should probably be called "Term to term multiplier", so it applies to tags, categories and any custom taxonomies.

    Personally, I don't think that just sharing a category should make a post related automatically, but that's what the Term to tax multiplier is for, you can set it to something higher.

  50. avatar
    wrote this comment on

    hi nicolas. i've upgraded the plugin to 4.3.3, but now i get no related content at all.

    all my content is in pages. 'find post types' is set to page, the multipliers are set as default, no taxonimies ticked, and i've lowered minimum related score to 10.

  51. avatar
    wrote this comment on

    oops. all my content is in posts. 'find post types' set to post. all other settings as above. now only listing current page, as before.

  52. avatar
    wrote this comment on

    Could you give an example of your manual inclusion code that defines a specified custom post type and custom taxonomy please?

    For the life of me I can't figure out how to modify the manual inclusion code to specify the custom post type and custom taxonomy that it should use.

  53. avatar
    wrote this comment on

    The section "How to use different configurations at the same time" in the readme is all you need. The plugin will use the custom taxonomy your post type uses anyway. The usetax parameter is only for searches across different taxonomies, I assume you don't need that?

  54. avatar
    wrote this comment on

    Hi Nicolas. I've implemented your great plugin, but in the results i see private declared articles too. Thats realy not good. Ok, the articles are not accessible for the users without the rights, but i do not want, that the headers are showed in my public area.
    how i can prevent this? Is a secret option available for this?
    best regards
    Michael

  55. avatar
    wrote this comment on

    Hi Michael. No, this is not configurable at the moment, but I will add this feature in the next release.

    If you're comfortable with PHP you could edit lines 300 and 463 in inc/scorer.php to exclude them from the SQL query as a quick fix.

  56. avatar
    wrote this comment on

    Hi Nicolas,

    I have a quick question that your plugin may cure but I'm not sure, I was hoping you could give me some insight.

    On this page http://waterworks-lamson.com/authorized/ I have an "authorized dealer" search plugin set up that when you type the state in the search box "california" it will return the results (post)california then you have to click on that to get to the post.

    I would like to bypass the results page that you need to click on and go directly to the post. Is this possible?

    And..... I would like to only have the search on this (page).

    I hope you can help.... boy do I need it!

    Thank you for your time!

    Brent

  57. avatar
    wrote this comment on

    Hello Nicolas,

    I am trying to display custom post type thumbnails, but I can't get this to work.

    Could you tell me how to re-write frontend.php (L. 480...) to display my custom post type thumb?

    I call my thumbs like this:
    cp_get_image($post-&gt;ID, 'ad-thumb', 1);

    I would really appreciate the help... I just can't get it to work :-(

    Thanks,
    C.

  58. avatar
    wrote this comment on

    Well, I think that should be possible, but it depends a little on how your site was coded. I assume you had somebody build it for you, you could just ask that person to look into this or you can use my contact form if you're interested in hiring me :-)

  59. avatar
    wrote this comment on

    Hi, did you have a look at the readme.txt? It has examples for custom loops. cp_get_image() doesn't seem to be a wp function btw.

  60. avatar
    wrote this comment on

    Hello,

    Yes I looked at your read me file but I can't get your example to work with custom post type images, which is the whole point of using your plugin versus YARP.

    cp_get_image() is a custom function that works when I need to display thumbnails in the sidebar or anywhere in the posts so I know that it can be called. I'm just really fuzzy about this whole custom post system so I would appreciate the guidance.

    I'm sure many more people will be interested in knowing how to do this over time ;-)

    Thanks for understanding,
    C.

  61. avatar
    wrote this comment on

    Custom post types aren't different from normal posts in regard to thumbnails.

    The "How to build a custom loop of related posts" in the readme.txt features post thumbnails. Maybe I can help more if you ask a more specific question.

    Oh, and you should not hack the plugin files btw, everything can be done in a custom loop. If you find any limitation let me know and I'll see what I can do.

  62. avatar
    wrote this comment on

    Hi Nicolas, I manage a site with about 3000 posts: http://personensuchpool.de but no related posts will be shown. All your requirements are fulfilled: php5, mysql5. I deactivated other plugins but nothing and there are a lot of related ones. What do I wrong.
    Thank you
    Dietrich

  63. avatar
    wrote this comment on

    Sorry, dämlichen Fehler gemacht, 2 Plugins verwechselt. Nun muss ich nur noch anpassen. Klasse Plugin, danke
    Dietrich

  64. avatar
    wrote this comment on

    Thanks Nicolas. I tried the code you mentioned (below) and it works. But it's not a loop, so I can't add thumbnails to my related recipes. Is there a way with this plugin to make a custom loop that <a href="http://codex.wordpress.org/Custom_Post_Types#Querying_by_post_type" rel="nofollow">queries a custom post type?</a>

    'if ( function_exists( 'the_related' ) ) { the_related(
    get_the_ID(),
    array(
    'usept' =&gt; array(
    'recipe' =&gt; true
    ),
    'storage_id' =&gt; 'better-related-recipe'
    )

    );
    }'

  65. avatar
    wrote this comment on

    :-D Kein Problem! Bitteschön!

  66. avatar
    wrote this comment on

    Seriously? Did you miss the "How to build a custom loop of related posts" section? Just add your post type to $args.

  67. avatar
    wrote this comment on

    That last sentence is what I needed. We're not all programmers. Of course I saw the section, hence my original question of how to define the custom post type to use. And the answer is to add your custom post type to $args. Thx.

  68. avatar
    wrote this comment on

    Great :-)

  69. avatar
    wrote this comment on

    Cool plugin! I set up a custom loop with thumbnails. Is there a way to show related items with thumbnails before those that don't have one? Or to show only related items that have thumbnails?

  70. avatar
    wrote this comment on

    Yes sure, see http://codex.wordpress.org/Function_Reference/has_post_thumbnail for the latter. For the former you can store the posts with thumbnail in an external var or loop through your posts twice, see http://codex.wordpress.org/The_Loop

  71. avatar
    wrote this comment on

    Thanks. For some reason I couldn't get has_post_thumbnail to work wherever I tried to integrate it (I must've not found the proper place to use it in my custom loop.) But I was able to get it to work by adding this to the array of argument:
    ''meta_key' =&gt; '_thumbnail_id','

    From: http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up

    Your other option sounds cool, but is way over my head. Just wanted to post this in case it helps others.

    http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up#post-1769764

    One last question, if you’d be so kind.

    If, for instance, only 2 related posts are displayed with thumbnails, can a custom loop be set up to automatically display 3 random posts with thumbnails to fill out all 5 areas?

    This may be a hard one.

  72. avatar
    wrote this comment on

    This plugin doesn't show random posts. But you can probably just store the post IDs of the first loop and start a second loop that excludes those posts. See http://codex.wordpress.org/Function_Reference/query_posts for random order IIRC

  73. avatar
    wrote this comment on

    I got it to work! Thought I'd share. I set up two loops, and somehow figured out how to set up a counter, so that the second loop returns only enough thumbnails to fill in 5 total thumbnails in case fewer than 5 related items exist. This way there are always 5 thumbnails and it looks great. It's only missing one thing, an argument to exclude the current post itself on which these are displayed from being returned as a thumbnail. But I tried everything and haven't found an argument that works. But it's still pretty darn well. Works for me. Thought it might help others and wanted to share.

    <strong>Edit</strong> Sorry, I had to remove your code. WordPress is really lousy when it comes to code in comments. Can you pastebin your code? I'll be able to have a look then.

  74. avatar
    wrote this comment on

    http://pastebin.com/kMc78FEj

    Give this link a try. My code looks a little messy, so if you see a way to improve upon it, like excluding the current post, I'd love to hear.

  75. avatar
    wrote this comment on

    BTW, when I turn on WordPress' debug in wp-config, my code gives this notice:

    Notice: Undefined variable: do_not_duplicate

    The code obviously works. So it's not a big deal. But should I just set the variable equal to zero right before using it, so it's defined?

  76. avatar
    wrote this comment on

    Well, notices aren't so bad. Just define the variable before trying to access it. Like, $foo = array() etc.

  77. avatar
    wrote this comment on

    Hi, I have using your the plguin. but it is show some wrong in admin panel. I am using mysql 5.1.54 and your plguin v0.4.3.3.

    "There is no fulltext index for wp_posts.post_content
    There is no fulltext index for wp_posts.post_title"

  78. avatar
    wrote this comment on

    Your database probably doesn't use the MyISAM engine, which is the default for mysql. You should probably talk to your admin/hosting provider. This plugin will only support databases that support fulltext indexes.

    See the comments by Leonardo for how to test which MySQL engine you're using.

  79. avatar
    wrote this comment on

    I just see that InnoDB has been made the default with MySQL 5.5.

    You could <a href="http://dev.mysql.com/tech-resources/articles/storage-engine/part_1.html" rel="nofollow">change the engine for wp_posts</a>.

    I guess I could easily attempt to change the storage engine of the relevant table after asking for user permission. I'll be include such a feature in the next release.

  80. avatar
    wrote this comment on

    I think should use InnoDB,so mysql offical choose. we have to use InnoDB. I have plan update to mysql v5.5. I have try mysql5.1 to5.5. but it is has some issue.

  81. avatar
    wrote this comment on

    I'll have to look into the reasons why MySQL decided to use InnoDB by default. If you can't switch the content table to MyISAM this plugin isn't for you, at least not at the moment. This plugin uses fulltext indexes for the search, which InnoDB doesn't have. I'll keep an eye on the future development.

    By the way, MySQL changing the default storage engine will only affect new databases, not existing ones.

  82. avatar
    wrote this comment on

    I remember mysql offical said will give up MyISAM. This is a long time ago what they have decided. So I am use InnoDB. though I like the MyISAM easy backup.If I use MyISAM,then will not easy for mysql upgrade.

    now your plguin work in my WP blog. but I do not know what effect that error.

  83. avatar
    wrote this comment on

    thanks Nicolas for this plugin...

    Currently I am using YARPP but I am planning to replace that with the plugin developed by you...i have one question though (a noob here)..I want to use a thumbnails in the related posts..can you guide/suggest me how to do that.

    Thanks

  84. avatar
    wrote this comment on

    Do you know how to build a normal loop with post thumbnails? Do you actually use the post thumbnail feature? If so, there is an example of a loop in the readme.txt iirc.

  85. avatar
    wrote this comment on

    Hello Nicolas,

    I'm having this problem with the plugin:

    I'm trying to use the plugin to a post type called "Events", but it is showing only the posts of "events" are marked with the same taxonomy. I want him to show all posts "Events", regardless of their taxonomies. There's how to do this?

    Thanks for the plugin.
    Hug.

  86. avatar
    wrote this comment on

    Did you check the analyze function yet? Maybe the contents of your events just aren't related enough? Also, the plugin only checks relatedness in the post_content field, not in any custom fields.

  87. avatar
    wrote this comment on

    hi

    1st of I have to thank u for the great plugin ! it's really useful ! I got question :

    How can I insert it in my template and remove the automatic related links just after the post ? I wanna place it after the post block

    Thanx

  88. avatar
    wrote this comment on

    Check the options page, or the readme.txt.

  89. avatar
    wrote this comment on

    Hi nicolas,
    your plugin is nice, but after I installed for about two weeks, I can't display my preview post, even single post I.

    the error massage:
    Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in .../public_html/wp-content/plugins/better-related/inc/scorer.php on line 382

    now I'm deactivating the plugin and waiting your advice.

    thanks

  90. avatar
    wrote this comment on

    Hi,

    you'll have a hard time trying to get any plugins to work with 32MB. You should probably look into getting a better hosting package with more RAM.

    You could try to reduce the query limit and to activate incremental scoring.

  91. avatar
    wrote this comment on

    Hi, there is a problem with the admin backend: it doesn't seem to escape the values it tries to insert into the form.

    Try using

    &lt;strong style="color:red"&gt;Related Posts&lt;/strong&gt;

    in the title field. The value is saved correctly but when the form shows up again its broken.

  92. avatar
    wrote this comment on

    Exactly the same experience. PHP allowed size is same as above. Every othee plugin works like a charm. I tried to lower query limits. It allowed me to lower them to 100 (Query limit) and 200 (Total Query limit) , I also activated incremental scoring. But doesn't work. Failed to show the page at all. It started when the number of posts raised. There are currently about 8000 posts in the blog. Any suggestion ?

  93. avatar
    wrote this comment on

    Thanks for reporting this, I'll look into it ASAP.

  94. avatar
    wrote this comment on

    Well, I don't think this is something I can do much about. 32MB is really not enough to run many plugins. You could try the YARP plugin, maybe that works.

  95. avatar
    wrote this comment on

    Hi Nicolas,

    I just installed your plugin and was very impressed since it actually recognized the custom posts and ads through the admin settings panel in the classified theme that I'm using (ClassiPress from AppThemes), although when I test drive it on the front end, I always end up with "No related content found" despite checking all the custom fields in the settings and this theme explicitly uses the custom post types yet no results :(

    post page ad_listing
    category post_tag post_format ad_cat ad_tag
    I'm on a dedicated server so no DB issues, using WP 3.1 latest update and using ClassiPress theme. Admin preview: http://www. appthemes.com/demo/?theme=classipress-admin

  96. avatar
    wrote this comment on

    Did you try the analyze tag yet? It's usage is described in the readme.txt.

  97. avatar
    wrote this comment on

    No I haven't and I just realized that the plugin actually worked but only under the main Blog posts and not the custom posts and custom categories, I'll try the Analyze tag attempt and update you with the outcome.
    Thanks Nicolas.

  98. avatar
    wrote this comment on

    Hi Nicolas,

    Do you know what this warning might mean in regards to the code listed below it?

    Warning: array_keys() [function.array-keys]: The first argument should be an array

    $posts = array_slice( array_keys( $scores ), 0, 5 ); // keep only the the five best results

    Is this happening because no related items are found?

  99. avatar
    wrote this comment on

    Hi, is it possible to use it with special post (post type). I'm using post type to differ products from regular blog both in front and back end.

  100. avatar
    wrote this comment on

    Hi Nicolas, I've already read the readme.txt file and all comments above, but I've a doubt about using taxonomy.

    Say I have 2 different posts types, A and B, and a custom hierarchical taxonomy named "type", defined on both. If I use a configuration like this:

    http://w3b.pastebin.com/v0erkGFN

    should I get a selection of related posts from A to B (and viceversa), only if they SHARE THE SAME TERMS under "type" taxonomy, ?
    In other words, for a post in A (or B), can I get a list of related posts, but only selected among B (or A) posts classified with the same terms under the same taxonomy?

    Thanks in advance, Daniele.

  101. avatar
    wrote this comment on

    Yes, please check the readme.

  102. avatar
    wrote this comment on

    Hm, I'm not sure right now, but I'll look into this.

  103. avatar
    wrote this comment on

    Hi Daniele,

    hm, I don't think so. It's been a while I've worked on this code but I don't think you can query only one post type.

    What you could do is to filter by post type in the loop that displays the results though (I guess).

    For the next major release I wanted to rewrite the taxonomy scoring anyway, so I'll look into this. Thanks for the idea.

  104. avatar
    wrote this comment on

    Don't worry about this one. The error was only displayed when I had an issue with another plugin, but isn't showing anymore. In other words, it might be an issue, but it also might not be. But it isn't causing any problems on the site right now, and since I don't see the error on the front end anymore, I'm not worried about it. Thanks!

  105. avatar
    wrote this comment on

    Ok, thank you for the update!

  106. avatar
    wrote this comment on

    I can't activate che plugin. I'm using the WP 3.1 and the plugin Version 0.4.3.3. I also have Custom Post Type UI, Custom Field Template, Header and Footer and Tweet Import activate.

    #######################

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c01/h16/mnt/6224/domains/sodastudio.it/html/wp-content/plugins/better-related/better-related.php on line 44

  107. avatar
    wrote this comment on

    I think you're using PHP4? The plugins needs PHP5.

  108. avatar
    wrote this comment on

    You are right, I have php4.
    Thank you.

  109. avatar
    wrote this comment on

    hi nicolas - huge thanks for making a plugin that works with custom post types - quick question:

    my client has 3 distinct areas on the site - 3 blogs if you like - I filter these using categories - trouble is i use the category 'featured' across all 3 areas so it is relating blog posts just because they share 'featured' category

    is there any way I can say 'ignore the 'featured' category' when scoring?

    many thanks again

  110. avatar
    wrote this comment on

    Hi Dean, sure, it's documented in the readme.txt. There are various scoring options you can disable/enable.

  111. avatar
    wrote this comment on

    You can do this for just one specific category? by category ID?

    I thought you could only add/reduce weighting for all categories?

  112. avatar
    wrote this comment on

    Oh yes, you're right. No, that's not directly possible. There's a filter called 'better-related-taxquery' though. But I can't really recall if this query runs for more scoring methods. And there's no context on the filter.

    So with the filter it should be possible to exclude categories. If it helps you I could add context.

  113. avatar
    wrote this comment on

    thanks for your replies

    ideally I'd like it to ignore for example Category ID6 for scoring but not penalise any post if it has that category.

    my test site is here if you want to see [edit: 404]

    anything that is 'Featured' category is what gets sent to the slideshow - which build a 'false' relationship

  114. avatar
    wrote this comment on

    "There is no fulltext index for wp_posts.post_content
    There is no fulltext index for wp_posts.post_title"

    How I can solve this error?

  115. avatar
    wrote this comment on

    Greetings Nicolas!

    This is a great plugin. I have read this thread carefully and verified, that I am running PHP5 with MySQL 5.0.32. All tables are MyISAM. The plugin is creating FULLTEXT indexes called post_content_index and post_title_index for the post_content and post_title fields. I have even dropped and created the indexes by hand and used the code you suggested above. I received no errors in that process. My host will not be updating our MySQL version (grid based) for several months so I am stuck with it for now.

    Unfortunately, I still receive the below error. Do you have any other thoughts?

    There is no fulltext index for wp_posts.post_content
    There is no fulltext index for wp_posts.post_title

    Thank you very much!

    Mike

  116. avatar
    wrote this comment on

    Hm, that's odd. If the indexes exist maybe my code to detect them is buggy. Did you try to output related posts on the frontend? I'm not sure if the plugin would try to display them even without indexes detected.

    What you can try is to add a <code>return true;</code> on line 223 of better-related.php to bypass the index detection. Please do tell me if the plugin works then, as that would be a rather annoying bug :-|

  117. avatar
    wrote this comment on

    Nicolas,

    I was able to get this corrected. It was not a problem with you plugin but with my database. I asked my host to take a look at the MySQL server and they corrected or changed something. Thank you for your comments and a great plugin!

    Mike

  118. avatar
    wrote this comment on

    Glad to hear it works :-)

  119. avatar
    wrote this comment on
    Hi Nicolas, Your plugin is really perfect. It is no doubt the best among all the similar plugin. I have encountered a problem that I am unable to resolve hoping you can kindly help on it. My blog can set the post to be automatically outdated for a period of time and the updated post will not be shown publicly. However the related post plugin can find the related OUTDATED post and show up the OUTDATED post title. How can I exclude those OUTDATED post from the related post result? Or do not show post more that a period of time, say 30 days? Many Thanks in advance.
  120. avatar
    wrote this comment on
    To follow up my previous comment. My question is how to exclude the "Privately Published" post? THANKS!
  121. avatar
    wrote this comment on
    The readme.txt has examples on how to build custom loops. That should make it easy to exclude some posts.
  122. avatar
    wrote this comment on
    In the scorer.php Line 300, I change to: WHERE ( post_status='publish') from: WHERE ( post_status='publish' OR post_status = 'private' ) And Line 463 I change to: AND ({$prefix}posts.post_status = 'publish') from: AND ({$prefix}posts.post_status = 'publish' OR {$prefix}posts.post_status = 'private') But it is still showing the private posts. What should I do? MANY THANKS!
  123. avatar
    wrote this comment on
    Did you clear the score cache? You can do it on the options page.
  124. avatar
    wrote this comment on
    Same/similar issue here. When I inserted "return true;" on line 223 the plugin worked great.
  125. avatar
    wrote this comment on
    I really love Better Related Posts. It pulls in all the content I want it to seamlessly. But there is another related posts plugin that I am tempted to use in place of Better Related Posts: Related Post Thumbnails! I love the plugin because of the thumbnails feature, but it just doesn't pull in "related" posts like Better Related Posts does. Think you could add optional thumbnail functionality? I really like how well Better Related Posts, but it just isn't "pretty" enough. Great job on it though; it's the best one I've found! Thanks, Kallan
  126. avatar
    wrote this comment on
    Hello Kalan. No, I prefer to keep this plugin lean. However, adding thumbnails to the list display is very easy and there's even an example in the readme.txt on how to do it.
  127. avatar
    wrote this comment on
    hi nicolas I'm making heavy use of custom meta fields in my site - and importing data into them from a Filemaker database When I look at my database tables every custom field seems to have a duplicate - so I end up with one populated by filmmaker and one empty Can i just check whether your plugin needs there to be duplicates of custom fields to work? Would your plugin duplicare custom field data in the wordpress database? any help greatly appreciated
  128. avatar
    wrote this comment on
    Hi Dean. This plugin uses the post meta to store relatedness scores. It stores all of them in one meta field, so it doesn't duplicate fields. The default field name would be something like better-related.
  129. avatar
    wrote this comment on
    Thanks for the plugin- if I can get it working, it will be the only one that can handle custom post types and related posts. But I cant get it to work with custom post types. It is displaying related content just fine with related pages and posts, but it is not displaying any related content from my custom post type 'events'. I have read the readme 20 times and all forums/comments. Can you help?
  130. avatar
    wrote this comment on
    Hello, When I try to activate the plugin, I'm back with "plugin is enabled"but it remains off the list and I found nowhere menu for the parameter, and front "Call to undefined function" ??? Thank you for your help.
  131. avatar
    wrote this comment on
    Check the plugin options page and select your custom post types? That should do.
  132. avatar
    wrote this comment on
    Can you post the complete error? Are you maybe running an outdated WordPress version or PHP4?
  133. avatar
    wrote this comment on
    Hi Nicolas, Is it also possible to show your plugin as a widget?
  134. avatar
    wrote this comment on
    Hm, I haven't included a widget. You could give it a try yourself, writing a simple widget isn't too hard. You might have to save the post ID into a variable and use it with the the_related_get_scores() call, I'm not sure if global $post is still set after the loop.
  135. avatar
    wrote this comment on
    hi again Nicholas I asked this above but was not sure I was clear on on my question" Can you remove one specific category from influencing the score? I have lots of posts that use the category 'Featured' to send them to a home page slideshow but they are not related. The plugin obviously thinks they are. So - is there any way to tell the plugin to ignore JUST the 'Featured' category for scoring purposes? Hope you can help Dean
  136. avatar
    wrote this comment on
    Hmmm, I don't think this is possible, but I'd have to check the source code again. Pretty busy at the moment though, sorry about the late reply.
  137. avatar
    wrote this comment on
    Hi, I've read through all the comments here and the readme.txt but I can't seem to get this to work quite right. When I use the plugin to automatically embed the related posts, it works fine but I can't get the manual insert with a custom loop to work. I need to call the plugin only on the single post pages for my 'work' custom post type, and want it to pull custom posts from the 'artists' custom taxonomy. It works find when I use the settings in the admin panel but with - as far as I can gather - the same settings manually coded in it's only calling regular posts that don't share the 'artists' taxonomy. This is the code I'm using: http://pastebin.com/HAJw1c5M
  138. avatar
    wrote this comment on
    You are passing $args to WP_Query that you should pass to the_related_get_scores(). WP_Query doesn't know what to do with any of these. You need the_related_get_scores( get_the_id(), $args ), and to pass the result of that as 'post__in' parameter to WP_Query.
  139. avatar
    wrote this comment on
    Hi Nicholas, I've read the readme.txt. But I do not find how to exclude certain category or tags of my post. Example: i wanna hide related post from category "video". Can i ? What code should i write on the single.php ? Thanks. I'm sorry i can't speak english well. Hehehe..
  140. avatar
    wrote this comment on
    I think you can do that by just passing the necessary parameters to the WP_Query (if you build a custom loop like described in the readme.txt)
  141. avatar
    wrote this comment on
    I really newbies Mr. Nicolas. I'm not a Superp Programmer like you. I still dont understant what u describe in readme.txt. Can u write that code here. So i can just copy and paste it to my single.php ? GOD BLESS YOU.
  142. avatar
    wrote this comment on
    Hi I have the same problem and still no solution
  143. avatar
    wrote this comment on
    I'm not even sure what the problem is.
  144. avatar
    wrote this comment on
    This plugin shows the best post selection among other related posts plugins so I stoped on it. But is there any way to force one post alway to appear for another post i.e. to set some custom field like related_post_1 = URL ? If there is, I could not find it, if not, I think it would be a great idea to add it. Any way, here's your plugin in action: http://www.bielousov.com/2011/toronto-lollipop/
  145. avatar
    wrote this comment on
    There's no built-in way to do this at the moment, no. If you know a little about wp coding you could probably just use a custom field and use that for the custom loop you build.
  146. avatar
    wrote this comment on
    I've got two post types set up and each has the same set of custom taxonomy. For example one post type is called 'Events' and another called 'Training' and then both post types have the same set of taxonomy. I'm looking for a way to cross reference posts. With this plugin is it possible to get the taxonomy from the current post, but then display related posts from the other post type with that same taxonomy name? Thanks
  147. avatar
    wrote this comment on
    Yeah. In fact that's the default behavior. If you select taxonomies to include in the relatedness score each term of every taxonomy is checked against every term from all other selected taxonomies. It's actually a bug, but a small and sometimes useful one so I haven't fixed it yet. I'll probably keep this as the default behavior in the future as well as some people might depend on it.
  148. avatar
    wrote this comment on
    Current version still has this problem with: There is no fulltext index for wp_posts.post_content There is no fulltext index for wp_posts.post_title I am using WP 3.2 RC3, and since 3.2 minimum requirements for Wordpress is MySql 5.0. I guess that's the problem, engine is InnoDB on all tables... be sure to fix it before 3.2 goes official :) I went to PHPMyAdmin and changed the engine of 'posts' table to MyISAM, and your plugin works perfectly now :)
  149. avatar
    wrote this comment on
    Great Plugin! Just a small bugfix I was getting a PHP warning notice: Undefined variable: r in .../better-related/inc/frontend.php on line 169 when there were no related posts found. FIX:
    if (isset($r)) return $r;

  150. avatar
    wrote this comment on
    Thanks, I'll keep this in mind when I work on the next release.
  151. avatar
    wrote this comment on
    Just noticed that to display just 5 related posts on a blog, your plugin adds 17 SQL queries on a single post page. Isn't that too much? If you can optimize them to a more manageable number then it would be great.
  152. avatar
    wrote this comment on
    The plugin should cache all related posts it finds until you publish a new post. The number of queries also depends on the scoring methods you use. 17 queries itself isn't a problem at all. It can be a problem if those 17 queries have to go through a post table with a million posts though. That's why there's a query limit and incremental scoring.
  153. avatar
    wrote this comment on
    I can't seem to activate the plugin on Wordpress 3.2.1 with all other plugins disabled and with Twentyeleven theme. Any chance of making it compatible?
  154. avatar
    wrote this comment on
    Great code! I noticed in the files you disabled attachments as an option. I'm using another plugin (http://wordpress.org/extend/plugins/media-tags/) that uses custom taxonomies assigned to attachments. I hope someday you decide the plugin will support attachment relations. It would be great to have related images!
  155. avatar
    wrote this comment on
    That's a great idea! Unfortunately I'm not using wordpress for my own sites any more, so there's only the small chance a client would need this feature and allow me to release the upgrade.
  156. avatar
    wrote this comment on
    Do you get some error message?
  157. avatar
    wrote this comment on
    Wordpress produces no error messages - all I get is a message saying it is activated but when I look at the plugins list Better Related Posts plugin still has the activate option available.
  158. avatar
    wrote this comment on
    Hm, thanks, I'll have to test this.
  159. avatar
    wrote this comment on
    Hello, first of all: great plugin. Is there a way to display an excerpt following the related links? It would be great if it is possible to show the normal excerpt of the post (or a certain count of words of the content section)... Best regards, Oliver
  160. avatar
    wrote this comment on
    Yes this is possible, but you'll need to write a few lines of PHP code. It's documented in the readme.
  161. avatar
    wrote this comment on
    Hi Nicolas, Does this work with WP MultiSite Network. Is it compatible across network? Thank You!
  162. avatar
    wrote this comment on
    It depends on what you mean? Sure, it works on blogs inside a network. However, it doesn't give you related posts from other blogs in the network.
  163. avatar
    wrote this comment on
    Hi Nicolas, I'm using the custom code from the readme text (first example), but I can't get it to display the related post titles. It keeps saying 'no posts found'. Though in the $posts array all the post id's are ok (eg
    <?php Array ( [0] => 238 [1] => 428 [2] => 579 [3] => 606 [4] => 486 );?>

    <?php the_related();?>

    works fine, but I would like to use the custom code to display some metabox fields from a custom post type. Am I missing something? I'm not a coder, could you help me out a little bit? Thanks! Britt
  164. avatar
    wrote this comment on
    Hrm, can you paste your whole code here or on a pastebin site? Not really sure what's going on here.
  165. avatar
    wrote this comment on
    Hi Nicolas. Thank a lot for your superbe plugin - very helpfull. Unfortunately I am faceing the same problem like Thompson getting the following error messages: Warning: array_keys() [function.array-keys.php]: The first argument should be an array Warning: array_slice() expects parameter 1 to be array, null given I copied your code example as it is from the readme.txt file and added a custom post type. I would highly appreciate your help in this matter. Thanks, Benjamin
  166. avatar
    wrote this comment on
    Hi Nicolas, great plugin! Good work :) Got one question though; is it possible to show only related posts from the same custom post type? I only want to use the post_tag for relevance, but if you haven't filled in any tags somehow they show up on other custom post type posts... Thanks!
  167. avatar
    wrote this comment on
    Please pastebin your code and post a link.
  168. avatar
    wrote this comment on
    You can use the usept parameter for this. Please see the readme.txt
  169. avatar
    wrote this comment on
    Yup, that did the trick! When using multiple configurations they will all use the variables set in the global plugin settings if you don't specify them right? Thanks again!
  170. avatar
    wrote this comment on
    Hi Nicholas Thanks for your quick answer. I have the following code inserted:
    <?php
    $scores = the_related_get_scores($post->ID, true);
    $posts = array_slice( array_keys( $scores ), 0, 6 );
    $args = array('post__in' => $posts, 'post_type' => 'teppich', 'posts_per_page' => 6 );
    $my_query = new WP_Query( $args );
    if ( $my_query->have_posts() ) {
    while ( $my_query->have_posts() ) {
    $my_query->the_post();
    $url = get_bloginfo('url');
    $directory = get_bloginfo('template_directory');
    $orderid = get_post_meta($post->ID, 'order-id', true);
    echo '<li><a href="' . $url . '/teppich/' . the_slug( get_the_ID() ) . '"><img src="' . $directory . '/teppiche/' . $orderid . '.jpg" /></a></li>';
    } } else { echo "No posts found..."; } ?>

    An example of the page you'll find on http://karpet.ch/redesign/teppich/almaty/ I adjusted the code slightly, but even with the code from your readme.txt file, i got the same problem. Below the the «Diese Shyrdaks werden Ihnen auch gefallen» 6 related items should be listed within the slider. The weird thing is, that sometimes it works but most of the time i get the above mentionned error message. Thank you so much for your kind help. A donation for your superbe plugin will be for sure..! ;o) Regards from Switzerland, Benjamin
  171. avatar
    wrote this comment on
    I think the problem is that the_related_get_scores() returns null (or false, not sure how I coded that). So you should probably check if $scores is_array() before you run the rest of the code.
  172. avatar
    wrote this comment on
    Hi Nicolas, First, I would say thank you for making a great plugin. It solved a lot of my problems searching for related post plugin to display related videos of my site in which I realized it's using custom taxonomy. Other related post plugin doesn't work until I found yours. I just wonder on how to add a thumbnails to the results. I can only find the title link. I read your readme.txt but I don't know where i should start. I see this line in readme.txt: if ( has_post_thumbnail() ) { the_post_thumbnail( 'thumb' ); } echo '
    '; I don't know if this is the line I am looking for and if it is,I don't know where to insert it, what file should I edit. Hope you can help me with this little problem. You are a great talented person. Thanks.
  173. avatar
    wrote this comment on
    Yes, this is the code to add the thumbnail. You just add it where you want to thumbnail to appear inside your loop. See http://codex.wordpress.org/The_Loop for an introduction.
  174. avatar
    wrote this comment on
    hi, the plugin works great for me but I have one little problem in admin area.. I've entered at "Related posts title" the following: ~span style="background-color: #FFDECF;"~Related:~/span~ After I saved changes, it appeared as '~span style=' in text area and 'Related:" size="60" /~' outside the editing area. I don't really need to change it right now but for the future, where should I look for editing this?
  175. avatar
    wrote this comment on
    Hi, yep i agree with everyones sentiment that this is great plugin, so thanks, but i seem to be having trouble getting it to work, good chance im overlooking something so was hoping you could offer some insight. When i have the plugin enabled to show up in default wp posts it works fine. But when i use a cpt with a default content editor and custom fields its returning 'No related content found' in that post type or for any other post type. ive tried with both the admin options and the manual options in the readme. I get the same result when i run the_related_analyze() too. Id does however return results for the default wp posts when i use the 'custom loop of related posts' example in a ctp. At a bit of lose and would be if you could offer some advise. Much Appreciated
  176. avatar
    wrote this comment on
    Hi! The Plugin is very nice and used to work for me, but I recently changed my theme and since then the releated posts only show up in the single-post-view. Is there some solution? Thanks for all :-) Miri
  177. avatar
    wrote this comment on
    Hm, not sure what you mean, but you should probably use your normal css stylesheet and add rules there.
  178. avatar
    wrote this comment on
    I think I add a filter on the_content to add the related posts. Maybe your theme is a little odd and doesn't use that default template tag. In the readme.txt is a method to place the related posts manually, you could try that.
  179. avatar
    wrote this comment on
    the_related_analyze() should show a lot of different scores IIRC. Don't you get any related value anywhere? Maybe it's a caching issue, there should be some reset scores option on the admin page (or change the storage key).
  180. avatar
    wrote this comment on
    Yeah i only get 'No related content found.' on all the listed items when i call the_related_analyze(). Ive started with a fresh db, created a new ctp and added 2 new posts with related titles and content but still nothing is returned and i get 'No related content found'. Not sure what else to look for?? Thanks
  181. avatar
    wrote this comment on
    hey, thank you for your answer. Let me make it easier to understand: how can I edit the text that is underlined with red in the following picture: http://img197.imageshack.us/img197/2434/betterrelatedcontent.png
  182. avatar
    wrote this comment on
    Hmmm, your cpt uses the normal editor, doesn't it. Maybe your posts are just so different that they aren't related to each other at all?
  183. avatar
    wrote this comment on
    Oh, this might look like a bug. I'll look into a fix. I should have a little time soon.
  184. avatar
    wrote this comment on
    this is really cool plugin...how can i edit the css for it to even show thumbnails for post too...thank you
  185. avatar
    wrote this comment on
    IIRC the readme.txt has an example of a custom loop.
  186. avatar
    wrote this comment on
    Hi, I do you clear the score cache ? Indeed I still can see private posts...
  187. avatar
    wrote this comment on
    Hi there, I'm getting some errors at the top of my related posts all of a sudden: Warning: array_keys() [function.array-keys]: The first argument should be an array in /path-to/single.php on line 69 Warning: array_slice() expects parameter 1 to be array, null given in /path-to/single.php on line 69 Warning: array_search() [function.array-search]: Wrong datatype for second argument in /path-to/single.php on line 79 etc. But only on 1 certain post? In single.php line 69 looks like this:
    <?php
    $scores = the_related_get_scores(get_the_ID(), array( // Line 61
    'usept' => array(
    'post' => true
    ),
    'usetax' => array(
    'post_tag' => true
    )
    ));
    $posts = array_slice( array_keys( $scores ), 0, 5 ); // Line 69
    $args = array(
    'suppress_filters' => true,
    'post__in' => $posts,
    'posts_per_page' => 5,
    'caller_get_posts' => 1
    );
    $my_query = new WP_Query( $args );
    function orderby( $a, $b ) {
    global $posts;
    $apos = array_search( $a->ID, $posts ); // Line 79
    $bpos = array_search( $b->ID, $posts );
    return ( $apos < $bpos ) ? -1 : 1;
    }
    usort( $my_query->posts, "orderby" );
    ?>

    Any ideas on what might be causing the problems? The particular post on which the problem occurs has some and