Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. if ( ! function_exists( 'string_limit_words' ) ) :
  2. function string_limit_words($str, $limit = 18 , $need_end = false) {
  3. $words = explode(' ', $str, ($limit + 1));
  4. if(count($words) > $limit) {
  5. array_pop($words);
  6. array_push($words,'...');
  7. }
  8. return implode(' ', $words);
  9. }
  10. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement