[Plugin: List category posts] Suggestion: Improving string cut when building excerpts
-
Hello, Fernando!
Thanks for the grat plugin!
Just one suggestion to improve it a little bit. When you build excerps you cut strings exactly at 252-nd char. This results in showing “black-diamond-question-mark” sometimes when cutting cyrillic strings. In order to work this out, you can cut string at a nearest space.So, this is your original string (CatList.php):
$lcp_excerpt = substr($lcp_excerpt, 0, 252) . '...';
And my suggestion is to replace it with this one:
$lcp_excerpt = substr( $lcp_excerpt, 0, strrpos( substr( $lcp_excerpt, 0, 252 ), ' ' ) ) . '...';
So, it just cuts excerpt at the nearest space before 252nd char.
Cheers,
Andrey
- The topic ‘[Plugin: List category posts] Suggestion: Improving string cut when building excerpts’ is closed to new replies.