You are here: Home » Extending WordPress » How To Customize Estimated Reading Time Plugin for WordPress

How To Customize Estimated Reading Time Plugin for WordPress

by Dave Doolin on June 24, 2009 · 3 comments

(Reading time: 1 – 2 minutes)

Ben grabbed a coupon to force me to expose my secrets for the “estimated reading time” that leads off each post. I wasn’t going to tell anyone how I did this because it’s so easy, really, it’s a snap. I’m going to show you how to do this in 3 easy steps.

  1. Install Estimated Reading Time plugin. Use “Plugins >> Add New” from the administrative panel.
  2. Modify plugin. Go to the plugin editor and open up estreadtime.php. It looks like this:
    36
    37
    38
    39
    40
    41
    42
    43
    
    else
        $output = sprintf(__("Reading time: %s - %s minutes"), $minutes_fast, $minutes_slow);
     
        if ($return)
           return $output;
        else
           echo $output;
    }

    You want to change lines 40 and 42 so that they look like this:

    39
    40
    41
    42
    43
    
    if ($return)
       return '<p class="estread">' . $output . '</p>';
    else
       echo '<p class="estread">' . $output . '</p>';
    }
  3. Modify CSS. Here’s how mine looks:
    p.estread {
       padding-bottom: 1em;
       font-size: 65%;
       font-weight: bold;
    }

That’s all there is too it!

Or is it…

I’ve done something else pretty sneaky to get exactly the layout I want. Can you guess what it is?




Would you like more? Send me a letter...
"Hi Dave,
Website In A Weekend seems pretty cool. I'm serious about this WordPress and web stuff, and I'd like to keep up with it. My name is and my email address is . I'm comfortable with email newsletters. I know you will protect my privacy, and that I can unsubscribe at any time. "

{ 2 comments }

Claudia February 1, 2010 at 10:57 am

Thank you so much for sharing this! Being a PHP novice, I found myself at a complete loss on how to integrate CSS styling with the output. Now I’ve learned something new…many thanks again!

Dr Wordpress! February 1, 2010 at 11:37 am

Claudia, this is pretty close to a perfect first php/css project for an aspiring do-it-yourselfer.

Let me know how it turns out.
Dr Wordpress!´s last blog ..How Moderating Comments On Your Blog Destroys Conversation My ComLuv Profile

Comments on this entry are closed.

{ 1 trackback }

Previous post:

Next post: