Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'string_limit_words' ) ) :
- function string_limit_words($str, $limit = 18 , $need_end = false) {
- $words = explode(' ', $str, ($limit + 1));
- if(count($words) > $limit) {
- array_pop($words);
- array_push($words,'...');
- }
- return implode(' ', $words);
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement