How to: Related Posts with WP Beginner WP Beginner WP Beginner Thumbnails in WordPress without Plugins By Rewrite content 06 February 2010 at 10:21 and have No Comments

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() )

  • Related posts can be easily displayed with plugins, but did you ever wonder how you could display related posts with a Thumbnail without using a Plugin? In this article, we will share two different algorithm which you can use to generate related posts with thumbnails and avoid using any plugin.

    WordPress has this amazing taxonomy known as “Post Tags” which you can use. You can tag each of your posts with multiple keywords. This algorithm would find other posts with any one of the tag that the current post has and will list them.

    How to: Related Posts with Thumbnails in WordPress without Plugins is a post from: WPBeginner which is not allowed to be copied on other sites.

    Creating a Mini Plugin to Show Related Posts via Functions.php

  • Article Source : How to: Related Posts with Thumbnails in WordPress without Plugins

    Leave a Reply