Family Encyclopedia >> Electronics

How to display related posts in WordPress

If you know anything about bounce rate, you are probably already displaying related posts in WordPress. Bounce rate essentially represents the percentage of initial visitors to a site that "bounce" to a different site, rather than continuing on to other pages within the same site. This can have a significant impact on your AdSense earnings. By adding related posts in WordPress, you are killing three birds with one stone. You're decreasing your bounce rate, increasing your AdSense earnings, and lastly, increasing your pageviews. In this article, we will show you how you can display related posts in WordPress with and without a plugin.

There are two methods to do this and you can choose the method you prefer. One way is to do it without a plugin and then there is another method that does it with a plugin.

Show related posts in WordPress without a plugin

Paste the following code into single.php where you want to show related posts

 CARNÉ DE IDENTIDAD); if ($ tags) echo 'Publicaciones relacionadas'; $ first_tag = $ tags [0] -> term_id; $ args = array ('tag__in' => array ($ first_tag), 'post__not_in' => array ($ post-> ID), 'posts_per_page' => 5, 'caller_get_posts' => 1); $ my_query = new WP_Query ($ args); if ($ my_query-> have_posts ()) while ($ my_query-> have_posts ()): $ my_query-> the_post (); ?> 


Display related posts in WordPress with a plugin

The plugin we use is called Yet Another Related Post Plugin (YARP). It provides you with a list of posts and/or pages related to the current post, introducing the reader to other relevant content on your site. Key features include:

  • An advanced and versatile algorithm:Using a customizable algorithm that considers post titles, content, tags, and categories, YARPP calculates a "match score" for each pair of posts on your blog. You choose the threshold limit for relevance and get more related posts if there are more related posts and less if there are fewer.
  • Templates:New in 3.0! A new template system puts you in charge of how your posts are displayed.
  • Cache:New in 3.0! YARPP now caches related posts for all posts and thus has significantly improved performance compared to 2.x versions.
  • Related Posts in RSS Feeds:Show related posts in your RSS and Atom feeds with custom display options.
  • Disallow certain tags or categories:You can choose certain tags or categories as disabled, which means that any page or post with such tags or categories will not be served by the plugin.
  • Related Posts and Pages:Allows you to control related posts, pages, or both.

Download YARP