Show most popular WordPress posts without a plugin

Heres a little trick on how to show a list of the most popular WordPress post by post read count – without using a plugin.

Add this code to your functions.php file.

Then add this anywhere in your template where you wish to display the posts.