I have a plugin where in the characters are limited by a specified value
using
wp_html_excerpt($title, $truncatetitlechar)
How can I delimit the $title by the word count.
I want to use something like
excerpt($truncatetitlechar)
Any suggestions?
Assuming you’re trying to truncate the title in a template file, you can define a new function in functions.php:
and call it in your loop instead of the default wordpress title function:
You can also pass parameters into the function when you call it, or change the defaults in the function above. The first parameter is what will be tacked on to the end of the trimmed title, and the second is how many words you wish to allow.
This answer was a combination of this and this.