-
Author
-
June 4, 2014 at 08:52 #19327ahcParticipant
Hi,
I have a post in Japanese characters. In the Post Masonry page the post is not displaying “…” after the excerpt. I tracked down the function in theme-functions.php:
if (!function_exists(‘kleo_excerpt’)) :
function kleo_excerpt($limit = 20) {
$excerpt = explode(‘ ‘, get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(” “,$excerpt).’…’;
} else {
$excerpt = implode(” “,$excerpt).”;
}
$excerpt = preg_replace(‘\[[^\]]*\]
‘,”,$excerpt);
return ‘<p>’ . $excerpt . ‘</p>’;
}
endif;It seems count($excerpt) always return 1. Please help.
June 9, 2014 at 22:43 #19568AbeKeymasterHi, kleo_excerpt will count words, 20 by default, and if there are found more than 20 then the “…” will be added.
Probably your text does not contain spaces since the words are found by splitting the sentence by space in explode( ‘ ‘, get_the_excerpt(), $limit )Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.June 10, 2014 at 04:09 #19584ahcParticipantHi,
I see. That’s not going to work for certain languages, e.g. Chinese and Japanese sentences don’t usually have spaces, and should be counted by the number of bytes. The posts displays only 4 or 5 lines and are truncated without the ‘…’, I guess the excerpt function uses a different logic to determine the length of the post to display. Where can I find the count function? For now I append ‘…’ regardless.June 17, 2014 at 00:19 #19921AbeKeymasterThe kleo_excerpt is the only function that takes care of that and you can see the count there
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.