[Resolved] Blog setting "Excerpt word count" doesn't work on other language.

Home Forums Support Blog setting "Excerpt word count" doesn't work on other language.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1309816

    Hi all,
    I just brought your premium plan a week ago.
    Most of the things are good, I am satisfy about that.

    However, there is one thing I am so confuse , which is the setting under Customizing > Layout > Blog > Excerpt word count, the default value of “Excerpt word count” should be 20.
    There looks nice on your demo page, however, when I already wrote the article with Transitional Chinese version, it seems doesn’t count the words correctly. It looks terribly long chinese text display even if I set the “Excerpt word count” to 5-10.

    Would you please help or provide some solution can solve this problem?
    I am appreciated about this.

    Customer Support

    Hi, Thank you for your information provided,
    I followed your link and fixed the Excerpt word count problem.
    However,it seems that another issue existed, the problem is the “read more” button only disappear on chinese language article,the default english article remain normal, please check this

    I am look forward to hearing from your.
    Thanks a lot.

    Customer Support

    Try this function:

    function dez_filter_chinese_excerpt( $output ) {
        global $post;
        //check if its chinese character input
        $chinese_output = preg_match_all("/\p{Han}+/u", $post->post_content, $matches);
        if($chinese_output) {
            $output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">%3$s</a></p>',
                mb_substr( $output, 0, 50 ) . '...',
                __( 'Read more', 'generatepress' )
        return $output;
    add_filter( 'get_the_excerpt', 'dez_filter_chinese_excerpt' );

    Thank you for your help,
    The problem has been solved.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.