Today If you want to track a number of visits you can use hundreds of plugins that offer you with just that. But having a lot of plugins can both slow down your site and cause a potential vulnerability in the future.
NOTE: you should always make a backup before making any changes and have in mind that you will eventually have to update your theme/plugin and that update will probably remove all your customizations. Therefor you should use child themes for all theme-related modifications.
Next, copy the following code and paste it where you want to show the number of views
When it’s all done, you will see the post view like this:
The above code is a slightly modified version of the GretaThemes‘s snippets.