This topic has 3 replies, 2 voices, and was last updated 10 years by Abe.

  • Author
  • #19327
     ahc
    Participant

    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.

    #19568
     Abe
    Keymaster

    Hi, 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.

    #19584
     ahc
    Participant

    Hi,
    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.

    #19921
     Abe
    Keymaster

    The 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.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?