facetwp shorten text output
<?php
/** shorten text to a specified length and add ellipses
** may need adjusting if you need to support multi-byte characers
** https://www.php.net/manual/en/function.mb-substr.php
** https://www.php.net/manual/en/function.mb-strlen.php
**/
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'el-ymud8n' == $item['settings']['name'] ) {
if ( strlen( $value ) > 50 )
$value = substr( $value, 0, 50 ) . " &hellip";
}
return $value;
}, 10, 2 );