Query Function and Template Tags for WordPressHow to: Related Posts with Thumbnails in WordPress without Plugins
while( $my_query->have_posts() )
$my_query->the_post(); ?>How to: Related Posts with Thumbnails in WordPress without Plugins
Related Posts by Tags
Note: We will utilize the built-in WordPress Post Thumbnail Function. So it is best if you implement this.
Additional Sources:
echo '
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags)
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>5, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() )
Article Source : How to: Related Posts with Thumbnails in WordPress without Plugins
