Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Display value in frontoffice
- function display_value_time($content) {
- global $post;
- $value_time = get_post_meta($post->ID, '_my_field' , true);
- if($value_time != ''){
- if ($value_time < 2){
- $text = __( 'You will take less than a minute to read the article ', 'reading_time_domain' );
- }
- else{
- $text = __( 'Approximate length of article reading time : ', 'reading_time_domain' ). "<strong>" . $value_time." minutes </strong>";
- }
- return "<div class='reading-time'>". $text. "</div>" . $content;
- }
- return $content;
- }
- add_filter('the_content', 'display_value_time');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement