mirror of
https://github.com/itflow-org/itflow
synced 2026-03-04 12:54:51 +00:00
Added PHP Truncate Function to functions.php
This commit is contained in:
@@ -172,4 +172,15 @@ function get_device(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function truncate($text, $chars = 25) {
|
||||||
|
if (strlen($text) <= $chars) {
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
$text = $text." ";
|
||||||
|
$text = substr($text,0,$chars);
|
||||||
|
$text = substr($text,0,strrpos($text,' '));
|
||||||
|
$text = $text."...";
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user