WordPress has several easy-to-use features that are hard to leave behind when you move to other platforms. One of them is the function
The Codex defines
the_excerpt() as follows: “displays an excerpt of the current post with an ellipsis […] at the end; all HTML tags are stripped from the text; and only the first 55 words are kept.”
In the actual WordPress source code, we see that the words are defined as the characters separated by a specific non-word characters (\n, \r, \t, and space).
However, for some East Asian languages, the words are defined as the individual characters. Therefore, our
sk_excerpt plugin gives the flexibility to chose either word or character count. When you use the character count, it will try not to cut inside a word. Here are some use cases:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
1 2 3 4 5
1 2 3 4
However, for most layouts, I find that we get a more consistent look between languages when we think in terms of space used on the screen, so the algorithm switches to characters mode when the words have more than 10 characters on average.
1 2 3 4 5 6 7
By providing two measures (words and chars) which can be adjusted individually, we can accommodate the fact that the Chinese words are slightly wider.