Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • in reply to: Excerpt length setting is not working with Chinese #323293
    greattai
    Member
    Post count: 5

    Hi Rui,

    How can I put this on the child theme?
    Its overwrited after theme update. please advise, thanks!

    in reply to: Excerpt length setting is not working with Chinese #322374
    greattai
    Member
    Post count: 5

    Hi, sorry for so long.. what I did on these 3 functions on swift-framework/core/sf-formatting.php and its working fine for me now (to count characters instead of words):

    function sf_excerpt( $limit ) {
    global $post;
    $excerpt = “”;
    $custom_excerpt = sf_get_post_meta( $post->ID, ‘sf_custom_excerpt’, true );

    if ( $custom_excerpt != “” ) {
    //edited by titus
    //$excerpt = wp_trim_words( $custom_excerpt, $limit );
    $excerpt = wp_html_excerpt( $custom_excerpt, $limit, ‘…’);
    } else {
    //edited by titus
    //$excerpt = wp_trim_words( get_the_excerpt(), $limit );
    $excerpt = wp_html_excerpt( get_the_excerpt(), $limit, ‘…’);
    }
    $excerpt = preg_replace( ‘\[[^\]]*\]‘, ”, $excerpt );

    return ‘<p>’ . $excerpt . ‘</p>’;
    }

    function sf_content( $limit ) {
    $content = wp_trim_words( get_the_content(), $limit );
    $content = preg_replace( ‘/\[.+\]/’, ”, $content );
    $content = apply_filters( ‘the_content’, $content );
    $content = str_replace( ‘]]>’, ‘]]>’, $content );

    return $content;
    }

    function sf_custom_excerpt( $custom_content, $limit ) {
    $locale = get_locale();
    $content = ”;
    /* edited by titus
    if ( $locale == ‘zh_CN’ || $locale == ‘zh_SG’ || $locale == ‘zh_HK’ || $locale == ‘zh_TW’ ) {
    $content = wp_trim_words( $custom_content, $limit );
    } else {
    $content = $custom_content; // This is needed to keep formatting
    }*/
    $content = wp_html_excerpt( $custom_content, $limit, ‘…’);
    $content = preg_replace( ‘/\[.+\]/’, ”, $content );
    $content = apply_filters( ‘the_content’, $content );
    $content = str_replace( ‘]]>’, ‘]]>’, $content );

    return $content;
    }

    in reply to: Excerpt length setting is not working with Chinese #318521
    greattai
    Member
    Post count: 5

    Hi Ed,
    Thanks for your reply, but the problem seems still exist..
    May I know what do you update on the new zip ?

    As I know.. the usual “word length” is count by space for english,
    and chinese “word” without space.

    Is it possible to just give me a code to use on the child theme to count by words instead of space ?

    And I also suggest to add a option on the “Excerpt Length” by “space(default)” and “character” later on.
    thanks!

    *attached with the screen cap I use “15” as the Excerpt Length on your zip.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Excerpt length setting is not working with Chinese #318376
    greattai
    Member
    Post count: 5

    Hi Ed,
    Yes, I am using the latest theme and plug-in.
    Btw..the problem I want to fix is “chinese excerpt length”… its ok if you have other suggestion.
    thanks!

    in reply to: Excerpt length setting is not working with Chinese #317841
    greattai
    Member
    Post count: 5

    Hi!
    May I know the status of this issue?
    I got the same problem…
    I search around and found this plug-in to solve this issue but unfortunately its not working with the theme,
    please let me know, thanks!!

    WP CN Excerpt

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