Plugin Directory

Changeset 1035612


Ignore:
Timestamp:
11/30/2014 08:27:58 PM (11 years ago)
Author:
yingles
Message:

fixing issue with the reading time appearing inline when using the_excerpt

Location:
reading-time-wp/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • reading-time-wp/trunk/readme.txt

    r1035581 r1035612  
    5454== Changelog ==
    5555
     56= 1.0.3 =
     57* Fixes issue with miscalculating the reading time when using <!--more--> tags and the_content. Also fixes issue with reading time appearing inline when using the_excerpt.
     58
    5659= 1.0.2 =
    5760* Fixing bug with more tags in the_content
     
    7376= 1.0.2 =
    7477Fixes issue with miscalculated reading time when using <!--more--> tags
     78
     79= 1.0.3 =
     80Fixes issue with reading time appearing inline when using the_excerpt.
  • reading-time-wp/trunk/rt-reading-time.php

    r1035581 r1035612  
    44 * Plugin URI: http://jasonyingling.me/reading-time-wp/
    55 * Description: Add an estimated reading time to your posts.
    6  * Version: 1.0.2
     6 * Version: 1.0.1
    77 * Author: Jason Yingling
    88 * Author URI: http://jasonyingling.me
     
    4848       
    4949            add_filter('the_content', array($this, 'rt_add_reading_time_before_content'));
    50        
     50           
     51            add_filter('get_the_excerpt', array($this, 'rt_add_reading_time_before_excerpt'));
     52           
    5153        }
    5254    }
     
    102104        $postfix = $rtReadingOptions['postfix'];
    103105       
     106        if(in_array('get_the_excerpt', $GLOBALS['wp_current_filter'])) {
     107            return $content;
     108        }
     109       
     110        $content = '<div class="rt-reading-time">'.'<span class="rt-label">'.$label.'</span>'.'<span class="rt-time">'.$this->readingTime.'</span>'.'<span class="rt-label"> '.$postfix.'</span>'.'</div>';
     111        $content .= $originalContent;
     112        return $content;
     113    }
     114   
     115    public function rt_add_reading_time_before_excerpt($content) {
     116        $rtReadingOptions = get_option('rt_reading_time_options');
     117
     118        $originalContent = $content;
     119        $rtPost = get_the_ID();
     120       
     121        $this->rt_calculate_reading_time($rtPost, $rtReadingOptions);
     122               
     123        $label = $rtReadingOptions['label'];
     124        $postfix = $rtReadingOptions['postfix'];
     125       
    104126        $content = '<div class="rt-reading-time">'.'<span class="rt-label">'.$label.'</span>'.'<span class="rt-time">'.$this->readingTime.'</span>'.'<span class="rt-label"> '.$postfix.'</span>'.'</div>';
    105127        $content .= $originalContent;
Note: See TracChangeset for help on using the changeset viewer.