If you need to show the number of posts or pages on your WordPress site without using a plugin, you can write a simple function and add it to the functions.php

Wordpress

Now, in order to display the number of views, add this code to the single.php or page.php

<?php simple_post_views( get_the_ID() ); ?>

Bonus

If you also want to show the number of views in the WordPress admin dashboard, use this code:

Wordpress