You will find a lot of wordpress plugins for related posts which show wordpress related posts according to your current post. But the majority of them not adjust in your theme and break your theme when you integrate. Even several plugins unsafe for your database and hosting etc. Today We are giving a very simple solution, use the following code this will show related posts by using categories of the current post.
Use of this code is very simple copy the following code from here and past in functions.php file. And then call the function name ” relatedPostsbyCategory()” in your template file where you want to display related posts.