The update to the functions.php brings down the site!
You probably made a mistake in the syntax.
Maybe I'm missing it but I don't see anything in that code that will prevent it breaking inside html tags, and counting markup as words. For example,
<span class="hello">Hi</span> there.. How many words is that? It should be two, but if you break on spaces it is three-- "
class="hello">Hi</span>", and "
there.". See what I mean? And if you happen to have your word count at 1, you'd have a broken tag. I don't see anything to prevent that.
Also, that function runs
wp_trim_excerpt right at the end, which, if you trace it, results in the use of
wp_strip_all_tags() which will "Properly strip all HTML tags including script and style". I don't see how that function could work at all.
Let me see if I can find my function for exactly this purpose. Remind me if I don't get to it.