Ready to get started?Download WordPress


Related Posts for WordPress
Manual Ordering of Posts not working (11 posts)

  1. palmercomputer
    Posted 1 year ago #

    After searching for related posts, manually set order by clicking. After clicking UPDATE POST, related posts reorder themselves. Verified that MANUAL order is clicked in Settings.


    Post are in reverse order set in list.


  2. jpdeboer
    Posted 1 year ago #

  3. snoffel
    Posted 1 year ago #

    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

  4. jpdeboer
    Posted 1 year ago #

    @snoffel: worked for me!!


  5. snoffel
    Posted 1 year ago #

    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 ...

  6. snoffel
    Posted 1 year ago #

    ... 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 ...

  7. Cyp Luraghi
    Posted 1 year ago #

    @ snoffel

    Your first trick works. Thanks ;-)

  8. SaraRow
    Posted 1 year ago #

    Changing positions also worked for mi!! Great!

    By the way, thanks for this great plugin :)

  9. VentureMaker
    Posted 1 year ago #

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

    Any ideas what's wrong here?

  10. extrader
    Posted 1 year ago #

    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.

  11. dmaier
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic