Back to top

Affiliate Link: Looking to Monetize With Ads?? We Personally Use:

Ezoic

Add Reading Time Calculator To Acabado Posts

Featured Tiles

Many times it can help to have posted an estimated reading time at the start of your post to ensure the reader has an idea of the content length.

As an Amazon Associate we earn from qualifying purchases made on our website. If you make a purchase through links from this website, we may get a small share of the sale from Amazon and other similar affiliate programs. You can read our complete legal information for more details.

VALIDATED FUNCTIONING ON ACABADO V1.0.8

Many times it can help to have posted an estimated reading time at the start of your post to ensure the reader has an idea of the content length. Adding a timer into your content doesn’t take too much effort to add but the value for your readers can be incredible.

You will need to add the plugin “Code Snippets” to provide the ability to add your own code below, this is what helps calculate the reading time.

  1. Install [ Code Snippets ] Plugin
  2. Click [ Add New ]
  3. Name: Reading Time
  4. Code [ Paste Code From Below ]
  5. Click Radio For [ Only Run On Site Front-End ]
  6. Save & Activate
function reading_time() {
    $content = get_post_field( 'post_content', $post->ID );
    $word_count = str_word_count( strip_tags( $content ) );
    $readingtime = ceil($word_count / 200);

    if ($readingtime == 1) {
      $timer = " minute";
    } else {
      $timer = " minutes";
    }
    $totalreadingtime = $readingtime . $timer;

    return $totalreadingtime;
}

The next will be to edit your Custom-Post.php and add the line which will render the reading time.

  1. Open Appearance
  2. Select Theme Editor
  3. From The Right Hand Side Select [ template-parts -> content-post.php ]
  4. Find Line 69 and paste the below code before <DIV>
Add Just before this line
        <div class="reading-time">
        <?php
        $str1="Approx Reading Time: ";
        echo $str1 . " " . reading_time(); 
        ?>
        </div>

You can now go open a post on your site and you will see something to the effect of the top of this post or the screenshot representing it below:

You can use the below Custom CSS to change the time if you want it to stand out.

.reading-time {
    color: #0000ff;
}

This reading time based on the code in the snippet is one minute per 200 words. You can always adjust this time if you write more technical instruction or you believe that this time isn’t correct, this is the average speed most people will read at.

About Josh Koop

Hey Everyone! I hope that the short article you read today has taken you from a place of frustration to a place of excited anticipation for your visitors! Please let me know of anything you need for Acabado that can help you achieve your goals!

My Posts | Website

Josh Koop

Hey Everyone! I hope that the short article you read today has taken you from a place of frustration to a place of excited anticipation for your visitors! Please let me know of anything you need for Acabado that can help you achieve your goals!

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Content