Support » Plugin: Related Posts for WordPress » [Plugin: Related Posts for WordPress] Manual Ordering of Posts not working

Viewing 10 replies - 1 through 10 (of 10 total)
  • I had the same problem, it only appears if you use the “Yes i want the link on both posts” option.

    I think there is a problem with the SQL statement inside of the “reciprocal query”, after some testing I tried the following:

    I changed “position1” into “position2” and reverse in the lines 427 and 448 in mikrokid_related_posts.php and it worked for me.

    Not really sure if that is a general solution …?

    Im using Version 4.0.3

    @snoffel: worked for me!!


    Oops, I found another problem with the “reciprocal query”:

    I connected a lot of posts with my homepage (a custom page) and there I can order these related posts perfectly. But as soon as I change someting inside a post, the order on the homepage is just ruined.

    I found following lines in mikrokid_related_posts.php (line 313):
    $left_q ="post1_id=".$post_id;
    $right_q = "post1_id=".$v->post1_id;
    $relation_order = "position2=".$order_counter;

    As this gets connected with “AND” in an update-query, it can’t be right, but I still have trouble to find the right solution …

    … I have to confess, it is just try and error, I’m not really understanding what’s wrong … but at the moment I get it working like this:

    In mikrokid_related_posts.php
    starting form Line 290 in function MRP_save_relationships( $post_id, $related_posts ) I found this:

    every existing connecting is deleted MRP_delete_relationships( $post_id ), after that the array $existing_ones is always empty.
    so I disabled the delete command.

    It seems to work – even there ist still this double post1_id thing inside …

    Is there anybody with a deeper understanding going to fix this? my “solution” feels a bit strange …

    @ snoffel

    Your first trick works. Thanks 😉

    Changing positions also worked for mi!! Great!

    By the way, thanks for this great plugin 🙂

    I’ve tried to comment out MRP_delete_relationships( $post_id ); but manual ordering still doesn’t work…

    Any ideas what’s wrong here?

    it does reorder, but when it does the insert it is only entering a value in column position2. It appears the order in the admin and the display on single uses the value from column position1.

    So, if you are only doing manual ordering without reciprocal links you can change the insert sql a bit.

    look around line 353 for this line:
    $query = "INSERT INTO ".$wpdb->prefix."post_relationships VALUES( $post_id, $related_post , 0, $new_count )";

    change it to:
    ‘$query = “INSERT INTO “.$wpdb->prefix.”post_relationships VALUES( $post_id, $related_post , $new_count, $new_count )”;’

    instead of inserting a 0 for the position1 column you are inserting the order value.

    This solved my problem, but I’m sure it doesn’t really solve it well for the reciprocal links.

    I don’t need reciprocal links, so extrader’s solution works for me as well. Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Related Posts for WordPress] Manual Ordering of Posts not working’ is closed to new replies.