• Resolved kl8606

    (@kl8606)


    Hi,

    I am trying this plug, but I found that this plug cannot handle Chinese characters well. I try to find the possible solution for it. I found one solution for the similar issue.

    Find /wp-includes/formatting.php

    if ( strpos( _x(‘words’, ‘Word count type. Do not translate!’ ), ‘characters’ ) === 0 && preg_match( ‘/^utf\-?8$/i’, get_option( ‘blog_charset’ ) ) ) {
    $text = trim( preg_replace( “/[\n\r\t ]+/”, ‘ ‘, $text ), ‘ ‘ );
    preg_match_all( ‘/./u’, $text, $words_array );
    $words_array = array_slice( $words_array[0], 0, $num_words + 1 );
    $sep = ”;
    } else {
    $words_array = preg_split( “/[\n\r\t ]+/”, $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
    $sep = ‘ ‘;
    }
    Change ‘words’ to ‘characters_excluding_spaces’ or ’characters_including_spaces’.

    Can we have the feature added to this plug? thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brian Hogg

    (@brianhogg)

    Sorry to hear you’re having trouble!

    Yes I’d like to remove the custom excerpt function that’s in there now because of issues like this. But for the moment there is a new filter “ecs_event_excerpt” that you can use to create whatever excerpt you need. For example this in a functional plugin or functions.php (child theme) could work:

    function my_custom_ecs_excerpt( $excerpt ) {
        // you should be able to use get_the_excerpt() then modify as needed, before assigning to $excerpt
        return $excerpt;
    }
    add_filter( 'ecs_event_excerpt', 'my_custom_ecs_excerpt' );
    

    Let me know if you need any clarification. Thanks!

    Thread Starter kl8606

    (@kl8606)

    Thanks for your advice.

    Actually, I already adopt that solution I posted to resolve the excerpt issue for Chinese characters, and it works well for plugins I used in my testing site.

    I am not good at PHP coding, so now, I only can skip excerpt first.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘excerpt support Chinese characters’ is closed to new replies.