acf_get_truncated() ACF 5.0.0
This function will truncate and return a string
Хуков нет.
Возвращает
(Строку).
Использование
acf_get_truncated( $text, $length );
- $text (обязательный)
- -
- $length **
- -
По умолчанию: 64
Список изменений
С версии 5.0.0 | Введена. |
Код acf_get_truncated() acf get truncated ACF 5.9.1
function acf_get_truncated( $text, $length = 64 ) {
// vars
$text = trim($text);
$the_length = strlen( $text );
// cut
$return = substr( $text, 0, ($length - 3) );
// ...
if( $the_length > ($length - 3) ) {
$return .= '...';
}
// return
return $return;
}