Trouble using get_post

For Microkids related post plugin
He said

“Using the get_post() function you could get any data you need from
the related posts.”

and he posted this snippet of code.

$related_posts = MRP_get_related_posts( $post_id );

I’m not exactly sure how to use the get_post feature for this situation. I would like to display the titles and thumbnail for each post in that array. Any help would be appreciated.

3 Answers
3

possibly:

$related_posts = MRP_get_related_posts( $post->ID );   
    if( $related_posts ) foreach( $related_posts as $key=>$value ) { 
        //only holds the following information:
        //echo $key; //the related_post_id  
        //echo $value;  //the related post title
        echo get_the_title($key);     
        echo get_the_post_thumbnail($key);   
    }

(edited after downloading and testing the plugin)

Leave a Comment