Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tips Display Related Posts in WordPress without a Plugin
#1
If you know anything about bounce rate, you are probably already showing related posts in WordPress. Bounce rate essentially represents the percentage of initial visitors to a site who “bounce” away to a different site, rather than continue on to other pages within the same site. This can have a significant impact on your adsense earning. By adding Related posts in WordPress you are killing three birds with one stone. You are decreasing your bounce rate, you are increasing your adsense income, and lastly you are increasing your pageviews. In this article we will show you how you can display related posts in WordPress with and without a plugin.
How to Display Related Posts in WordPress

 Paste the following code in single.php where you want to display related posts

Code:
<?php
//for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo 'Related Posts';
$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(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

<?php
endwhile;
}
wp_reset_query();
}
?>

Also read 
Related Posts with Thumbnails in WordPress without Plugins

Finding it difficulty Using it on some theme drop a comment we will guide you 
To Purchase Credit Click here , For how to make money on Sologet forum Click here 

HIRE ME FOR WEBSITE DESIGNING US THE PM BUTTON TO SEND ME MESSAGE

There is love in sharing
[-] The following 1 user says Thank You to Kingsolomon for this post:
  • General
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Problems with seekhype theme Frizzy 0 16 04-02-2019, 12:12 PM
Last Post: Frizzy
  How To Show WordPress Post View Count Without A Plugin Kingsolomon 2 321 03-30-2019, 10:14 PM
Last Post: Jimohtour
  HOW TO Set mp3 tagger for wordpress djdozic 2 399 02-25-2019, 07:26 PM
Last Post: Kingsolomon
  HOW TO How to Fix the 502 Bad Gateway Error in WordPress khodex 1 206 01-09-2019, 07:48 AM
Last Post: Kingsolomon
  MUST READ 4 Ways To Remove Category from WordPress URLs Kingsolomon 1 308 12-18-2018, 10:10 AM
Last Post: Kingsolomon

Forum Jump:


Users browsing this thread:
1 Guest(s)

Display Related Posts in WordPress without a Plugin00