Skip to content

Instantly share code, notes, and snippets.

@mrbobbybryant
Created July 30, 2015 22:38
Show Gist options
  • Save mrbobbybryant/3a182cf10d035d7b9f5a to your computer and use it in GitHub Desktop.
Save mrbobbybryant/3a182cf10d035d7b9f5a to your computer and use it in GitHub Desktop.
Limit text length
<?php
function limit_ticker_length( $title, $length ) {
if ( strlen( $title ) > $length ) {
$title = substr( $title, 0, ( $length -3 ) );
$title = substr( $title, 0, strrpos( $title,' ' ) ) . '&#8230;';
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment