Why Chinese characters excerpt length limit isn’t accurate?

Knowledge Base > Sahifa > Why Chinese characters excerpt length limit isn't accurate?

in Sahifa

Due to the nature of the Chinese language chars, you will need to modify the code a little bit that control the excerpt functions to get it working properly, please edit this file:

(Sahifa/framework/functions/theme-functions.php)

and replace this code snippet:


function tie_excerpt(){
	add_filter( 'excerpt_length', 'tie_excerpt_global_length', 999 );
	echo get_the_excerpt();
}

function tie_excerpt_home(){
	add_filter( 'excerpt_length', 'tie_excerpt_home_length', 999 );
	echo get_the_excerpt();
}

With this one:

function tie_excerpt(){
	add_filter( 'excerpt_length', 'tie_excerpt_global_length', 999 );
	echo mb_substr( get_the_excerpt(), 0, tie_excerpt_global_length() );
}

function tie_excerpt_home(){
	add_filter( 'excerpt_length', 'tie_excerpt_home_length', 999 );
	echo mb_substr( get_the_excerpt(), 0, tie_excerpt_home_length() );
}

0