WordPress.org

Ready to get started?Download WordPress

Forums

Manual Related Posts
Order of Related Posts? (8 posts)

  1. nurenu
    Member
    Posted 11 months ago #

    I can't figure out where the order of the displayed related posts is coming from. In the Edit page, I can drag them into another order, but that isn't sticking. Here's an example of one of my test pages: http://roth-tompkins.com/test/portfolio/copley-square-seaglass/ and I was trying to have it display Summers, Bridgewater, Pembrook.

    http://wordpress.org/plugins/baw-manual-related-posts/

  2. cgossy
    Member
    Posted 11 months ago #

    I'm facing the same poblem

    Until this is supported by the pluging, I fixed this problem and changed "wp-content\plugins\baw-manual-related-posts\inc\bothend-noajax.inc.php"

    function bawmrp_get_related_posts

    function bawmrp_get_related_posts( $post_id, $only_published=true )
    
    {
    
    	global $bawmrp_options;
    
    	$ids = get_post_meta( $post_id, '_yyarpp', true );
    	$orig_order=wp_parse_id_list($ids);
    	if( $only_published ){
    
    		//$published_ids = !empty( $ids ) != '' ? implode( ',', wp_parse_id_list( wp_list_pluck( get_posts( array( 'include' => $ids, 'post_type' => $bawmrp_options['post_types'] ) ), 'ID' ) ) ) : array();
    		$published_ids = !empty( $ids ) != '' ? wp_parse_id_list( wp_list_pluck( get_posts( array( 'include' => $ids, 'post_type' => $bawmrp_options['post_types'] ) ), 'ID' ) )  : array();
    		$ids = array();
    		foreach ($orig_order as $id){
    			if (in_array($id,$published_ids))
    				array_push($ids,$id);
    		}
    		$ids = implode( ',',$ids);
    
    	}else{
    
    		$ids = !empty( $ids ) != '' ? implode( ',', wp_parse_id_list( $ids ) ) : array();
    	}
    	return $ids;
    
    }

    PLEASE Note that the changes will be deleted if you update the plugin!

  3. nurenu
    Member
    Posted 11 months ago #

    Hey cgossy,

    Thanks! That works to get them in the order that I input them. Next step would be to have the drag & drop re-ordering actually affect the order of displayed posts.
    This is great though and client is happy enough ;)
    - Trevor

  4. cgossy
    Member
    Posted 11 months ago #

    Hi

    Drag&Drop the related posts in the correct order and than press the "save" button of your post/page

    You don't have to do any code changes for that.

    cheers
    chris

  5. nurenu
    Member
    Posted 10 months ago #

    Hm, maybe that's a problem with my particular install then. "Publish" or "Update" for the post doesn't save the drag n drop order. And there is no further "save" button.

  6. cgossy
    Member
    Posted 10 months ago #

    Hi
    Did you check the cache settings of the plugin (Parameter "Caching data" on the plugin settings page)? If it is greater than 0 then your drag&drop changes will take effekt after the number of days that are set in the cache parameter .

    Set it to 0 for your Tests

    (And yes, I meant the "Publish" and "Update" button)

  7. nurenu
    Member
    Posted 10 months ago #

    oh geez. *face-palm*
    Yeah my caching wasn't 0. Thanks so much for all your help cgossy!

  8. cgossy
    Member
    Posted 10 months ago #

Reply

You must log in to post.

About this Plugin

About this Topic