Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #2709

    I was wondering what the criteria are for determining related posts are and where it can be edited. I love how this feature is built into habitat, unfortunately the “related posts” on my blog don’t really seem to be as closely related as some that are not listed. I hope this isn’t a dumb question. I did a bunch of searches and couldn’t find anything in here answering that. Any help would be appreciated!



    as far as I can see the related posts are determined via tags. In single.php you can find following code:

    <?php // related posts
    $this_id = $post->ID;
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {

    $tag_ids = "";
    foreach ($tags as $tag ) $tag_ids .= $tag->name.",";
    $tag_ids = substr_replace($tag_ids ,"",-1);

    $my_query = new WP_Query("tag=$tag_ids&showposts=7&caller_get_posts=1&orderby=rand");

    So posts which are tagged with the same words will be displayed as “related posts”


    For whatever reason that doesn’t seem to be the case. It seems like they’re just randomly chosen (or not chosen when they should be). These three posts have nearly identical tags but are not listed as related. I really like this feature and think it looks great and would really like to get it to work. Thanks for your continued help!

    http://outsmartingfish.com/2009/07/ (Purchase code hidden if logged out) -that-got-away/

    http://outsmartingfish.com/2009/07/ (Purchase code hidden if logged out) /

    http://outsmartingfish.com/2009/07/ (Purchase code hidden if logged out) -bull-trout-hunt/


    Try to change following line in single.php:

    $my_query = new WP_Query("tag=$tag_ids&showposts=7&caller_get_posts=1&orderby=rand");


    $my_query = new WP_Query("tag=$tag_ids&showposts=7&caller_get_posts=1");

    This should remove the shuffle feature. Maybe you’ll get better results.


    Thanks! No luck though.


    Still no luck. Any ideas?



    Sorry for the delay.

    The more precise related posts functionality is heavy, thus in order for a serious algorithm to be able to find posts that are even closer related would come at the sacrifice of your website’s load time. Please, let me give you an example.

    A free plugin called YARPP is great at matching related articles. However, in order to do that it takes up a lot of resources (http://yoast.com/wordpress-performance-optimization/ 7 out of 16 database calls in this article. )

    Now the question is, are you willing to sacrifice your loading speed (which Google uses as an integral factor in its algorithm to determine your site’s placement in the search results), or do you want to have articles that are better match?

    If you can balance the inclusion of YARPP (http://wordpress.org/extend/plugins/ (Purchase code hidden if logged out) /) through optimization, then it’s doable.

    You have a really sweet Server, very fast. (http://www.webpagetest.org/result/120901_Q7_d82decb70a6e960a601744599ec17ed1/3/details/) but you can optimize still a lot further. You can download the executive summary report on your website http://gtmetrix.com/reports/outsmartingfish.com/abHTFCcb/pdf



Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Related Posts Criteria’ is closed to new replies.