Function excerpt to WordPress


/ Published in: PHP
Save to your folder(s)

Usage:



Copy this code and paste it in your HTML
  1. function TruncateText ($str_text, $max_char) {
  2. if(strlen($str_text)>$max_char){
  3. return substr($str_text, 0, $max_char).'...';
  4. } else {
  5. return $str_text;
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.