The number of views is more than 1000 in the form of as 1K
-
Hello! Is it possible to reduce the number of views if there are more than 1000. For example 1300=1.3K. I tried to do it with help. this code, but it didn’t work.
function cp_convert_big_number($number) { $number = str_replace(',', '', $number); if ( $number >= 1000 ) { $number = number_format($number / 1000, 1) . 'K'; } else if ( $number >= 1000000 ) { $number = number_format($number / 1000000, 1) . 'M'; } else if ( $number >= 1000000000 ) { $number = number_format($number / 1000000000, 1) . 'B'; } return $number; } add_filter('number_format_i18n', 'cp_convert_big_number');
- You must be logged in to reply to this topic.