• I think an option to abbreviate view counts above 1000 would be useful.

    Example:
    849 = 849
    1,832 = 1,8K
    12,382 = 12,4K

    Also, my site uses a dot instead of a comma when displaying numbers. Could an option be added to display the view count with a dot instead? (so 12,382 would become 12.382, and 12,4K would be 12.4K)

    • This topic was modified 8 years, 2 months ago by Swennet.
    • This topic was modified 8 years, 2 months ago by Swennet.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dFactory

    (@dfactory)

    Hi,

    The plugin tries to “guess” what your preferred number format is by using WP native number_format_i18n() function https://codex.www.ads-software.com/Function_Reference/number_format_i18n

    You can control the output with number_format_i18n filter hook.

    So, when there’s a method do it with a small piece of code we don’t think there’s a need for another option.

    Thanks,
    Bartosz / dfactory team

    Thread Starter Swennet

    (@swennet)

    Thank you for your answer. If anyone else wants to do this, then copy this code into your theme’s functions.php file.

    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');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Request] Display option to abbreviate view counts above 1000 as 1K’ is closed to new replies.