Please review this!
I used the solution on the suggested/solved topic you guys marked as double but it didn't work.
I want to shorten my WordPress article/post titles to a max nr of characters of 65.
i'm using this code:
function custom_trim_my_title( $title ) {
if ( strlen( $title ) >= 65 && ! is_singular() ) {
$title = substr( $title, 0, 65 ) . '...';
return $title;
}
return $title;
}
add_filter( 'the_title', 'custom_trim_my_title' );
The idea is that this code cuts the words in half and i don't want that.
What can i do?
ps: i know you this is kinda of a duplicate but, i've tried everything and it didn't work.
Thanks in Advance!
Regards.