Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php  
  2. // Display value in frontoffice
  3.     function display_value_time($content) {
  4.         global $post;
  5.         $value_time = get_post_meta($post->ID, '_my_field' , true);
  6.         if($value_time != ''){
  7.             if ($value_time < 2){
  8.                 $text = __( 'You will take less than a minute to read the article ', 'reading_time_domain' );
  9.             }
  10.             else{
  11.                 $text = __( 'Approximate length of article reading time : ', 'reading_time_domain' ). "<strong>" . $value_time." minutes </strong>";
  12.             }
  13.         return  "<div class='reading-time'>". $text. "</div>" . $content;
  14.         }
  15.         return $content;
  16.     }
  17.     add_filter('the_content', 'display_value_time');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement