I need a split string with 2 divs, by the first div with 20 words and last div with rest of words to make read more link with javascript.
At the moment I have only character count limit.
How can I do word splitting?
if ( $term && ! empty( $term->description ) ) {
$first = substr($term->description, 0, 400);
$rest = substr($term->description, 400);
echo '<div class="term-description"><div class="first-letter">'.$first.'</div><div class="last-letter">'.$rest.'</div></div>';
}