<?php
$scores = the_related_get_scores(); // pass the post ID if outside of the loop
$posts = array_slice( array_keys( $scores ), 0, 5 ); // keep only the the five best results
$args = array(
'post__in' => $posts,
'posts_per_page' => 5,
'caller_get_posts' => 1 // ignore sticky status
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
echo '<a href="' . get_permalink( get_the_ID() ) . '">';
the_title();
echo '</a>';
the_excerpt();
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'thumb' );
}
echo '<br>';
}
}
else {
echo "No posts found...";
}
?>