Changeset 1035612
- Timestamp:
- 11/30/2014 08:27:58 PM (11 years ago)
- Location:
- reading-time-wp/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
rt-reading-time.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
reading-time-wp/trunk/readme.txt
r1035581 r1035612 54 54 == Changelog == 55 55 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 56 59 = 1.0.2 = 57 60 * Fixing bug with more tags in the_content … … 73 76 = 1.0.2 = 74 77 Fixes issue with miscalculated reading time when using <!--more--> tags 78 79 = 1.0.3 = 80 Fixes issue with reading time appearing inline when using the_excerpt. -
reading-time-wp/trunk/rt-reading-time.php
r1035581 r1035612 4 4 * Plugin URI: http://jasonyingling.me/reading-time-wp/ 5 5 * Description: Add an estimated reading time to your posts. 6 * Version: 1.0. 26 * Version: 1.0.1 7 7 * Author: Jason Yingling 8 8 * Author URI: http://jasonyingling.me … … 48 48 49 49 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 51 53 } 52 54 } … … 102 104 $postfix = $rtReadingOptions['postfix']; 103 105 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 104 126 $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>'; 105 127 $content .= $originalContent;
Note: See TracChangeset
for help on using the changeset viewer.