In some of our sites, we to show excerpts of posts (the content administrators don’t enter excerpts).
We could use the the_excerpt
function, but from what I could see, I can only control the amount of words it extracts, and that’s a little too general for us (a word could have 2 letters, or 10 letters…).
So we need a function that takes the number of characters and extracts that amount from the content. But we also don’t want the words be cut in the middle. One last need is that the function work with the multy-byte version of the string functions of php (for examplel: use mb_substr
instead of substr
)
Are there WP built in functions that would do this?
There are no built-in WordPress functions to trim strings by character count.