How to: Related Posts with Thumbnails in WordPress without Plugins
Posted February 6th, 2010
Query Function and Template Tags for WordPressHow to: Accompanying Posts with Thumbnails in WordPress after Plugins
Related Posts by Tags
Creating a Mini Plugin to Show Accompanying Posts via Functions.php
Related posts can be calmly displayed with plugins, but did you anytime admiration how you could affectation accompanying posts with a Thumbnail after application a Plugin? In this article, we will allotment two altered algorithm which you can use to accomplish accompanying posts with thumbnails and abstain application any plugin.
while( $my_query->have_posts() )
$my_query->the_post(); ?>How to: Accompanying Posts with Thumbnails in WordPress after PluginsNote: We will advance the congenital WordPress Column Thumbnail Function. So it is best if you apparatus this.
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 accompanying posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() )
Article Source : How to: Accompanying Posts with Thumbnails in WordPress after Plugins
How to: Related Posts with Thumbnails in WordPress without Plugins