The new blogging trend is letting your readers know how long a post will take them to read. You can easily add read time to a post using a plugin. But, there are just too many blog posts and tutorials out there that give you a plugin solution when you really need a PHP solution. Adding too many plugins to your site can slow it down and introduce security hazards. So, whenever possible, you should do your own coding or hire a developer for a longer-term solution.

If you’re looking for an all-in-one self-hosted solution, be sure to check out our WordPress hosting packages.

In this article, you will:

  • Learn why you need to use a child theme
  • Edit your theme files
  • Add reading time using PHP

WordPress guidelines for creating child themes.

Basically, child themes are the safest way to edit your theme files and retain the changes you’ve made.

Log into your WordPress Dashboard
  • Select Theme Editor under Appearance
  • Choose your theme’s single post template under Theme Files on the right side panel1
  • Now, any code you add to the single post theme template will affect all blog posts on your site.

    2 does all the calculation inside of PHP and then outputs the results in a basic HTML paragraph element. Feel free to update any of the settings, for example:

    • Update the paragraph text by changing “Estimated reading time” to any text you prefer, or erase it entirely
    • Change the estimated words per minute (200) to any value you think will be more appropriate for your readers
    • If you’d rather not have a paragraph, change the HTML <p> tags to fit your preference

    And that’s all it takes to add real PHP reading time estimates to your site. No plugin required! Be sure to let us know if you have questions or comments.



    The location of this file may be different for different themes. Be sure to read your theme documentation for the exact location of this file. Or, contact the developer.

    Code snippet credit belongs to