Git Product home page Git Product logo

estimated-read-time's Introduction

Estimated Read Time

The Estimated Read Time plugin for ClassicPress allows you to display expected reading times on your articles and summaries. The average person reads at 200 words per minute, so, that's the default setting. You can change it with a simple filter to suit your own audience and content.

Settings

There is only a single setting: the reading speed. To change the reading speed, you can use this filter.

Usage

To provide the most versatile placement options, the estimated read time display is implemented with a shortcode that is designed to be placed in your theme template files. It may require some experimenting to find just the right templates for your particular theme, but you can try the content.php, single.php, archive.php, and page.php templates as a starting point.

Note that the shortcode is designed to work in templates that are in the loop, so you won't be able to place the shortcode in, say, your header.php or footer.php files. See the examples below and place one or the other into your theme's template file(s) where you would like the estimated read time to be displayed.

Example 1: Minimal template shortcode

<?php echo do_shortcode('[estimated-read-time words="'.str_word_count(strip_tags($post->post_content)).'"]'); ?>

Example 2: Template shortcode with dashicon

<span class="dashicons dashicons-clock"></span> <?php echo do_shortcode('[estimated-read-time words="'.str_word_count(strip_tags($post->post_content)).'"]'); ?>

Important Note on Updating your Theme

If you are using a theme that is a parent theme (as opposed to a child theme) you will need to be cautious about updating your theme because the update will overwrite all the theme files. To avoid this, you have several options, as follows. Options are listed in the order of preference.

  1. use a child theme and add your shortcodes to your child theme's templates, or
  2. use a theme that you built yourself to avoid surprise updates, or
  3. carefully copy your shortcodes out of your theme files before updating, then replacing them afterward, or
  4. continue using the parent theme, but don't update it.

About azurecurve

azurecurve was one of the first plugin developers to start developing for Classicpress; all plugins are available from azurecurve Development and are integrated with the Update Manager plugin for fully integrated, no hassle, updates.

The other plugins available from azurecurve are:

estimated-read-time's People

Contributors

azurecurve avatar johnalarcon avatar

Stargazers

 avatar

Watchers

 avatar  avatar

estimated-read-time's Issues

Using the <!--more--> tag causes incorrect read times to display

HT to @azurecurve for reporting the following unexpected behavior.

If I have a <!--more--> in a post, the read time on the homepage or archive is only for the bit above the <!--more--> When you open the post, the read time is different as it is for the whole post.

A few things to verify and work out:

  • The post/page and excerpts should show total read time, regardless of <!--more--> tags. Verify that this expected behavior exists.
  • Any pages auto-created with a <!--more--> tag should have the full post's read time displayed. Verify the issue.

Possible Solutions

  1. Show full read time on all displays (ie, the extra pages generated by <!--more-->)
  2. Show read time of current auto-page as something like 4-mins of a 23-minute read.

I like the idea of the second solution, but, feel it's too verbose for the purpose. The first solution seems more viable. I'll leave this open a bit to gather any feedback before implementing the fix.

Display text is missing a hyphen

@EvoRay reported that the display texts are incorrect. He essentially stated the following:

Incorrect: 5 minute read
Correct: 5-minute read

I've researched this further and find that he is correct; the hyphen should be included.

Plugin lacks an update method

When a new version is released, there is no means to notify the user, neither is there any means to update the plugin. Instead, the user must first find out about the update, then download the master branch, then overwrite the existing files. This is prone to error and provides a poor user experience.

The original plan was to wait and have the ClassicPress Plugin Directory handle this, but, the various plugin have turned out to be more popular than anticipated. This can't wait.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.