Replace Archive Widget Link Text

I’m trying to replace the Roman numbers in the Archive Widget link (and all other numbers) with Khmer (Cambodian) numbers.

But while I do replace the link text with this code, it also replaces the link url which then breaks the link.

How do I just replace the archive link text, and not the url?

function convert_numbers_to_khmer( $string ) {
$khmer_numbers = array(‘០’, ‘១’, ‘២’, ‘៣’, ‘៤’, ‘៥’, ‘៦’, ‘៧’, ‘៨’, ‘៩’, ‘.’);
$english_numbers = array(‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘.’);
return str_replace($english_numbers, $khmer_numbers, $string);
}

function make_khmer_time( $the_time ) {
if ( get_bloginfo( ‘language’ ) == ‘km’ ) {
$the_time = convert_numbers_to_khmer( $the_time );
}
return $the_time;
}
add_filter( ‘get_the_time’, ‘make_khmer_time’ );
add_filter( ‘get_the_date’, ‘make_khmer_time’ );
add_filter(‘comments_number’, ‘make_khmer_time’);
add_filter(‘get_archives_link’, ‘make_khmer_time’);

Read more here:: Replace Archive Widget Link Text

Leave a Reply

Your email address will not be published. Required fields are marked *