Changing FP-Facts number layout

I’d like to be able to change the layout of the numbers displayed from FP-Facts. At present the numbers display as 1234567 but I want them to display as 1,234,567, with the integer differentiation.

Is there a code where I can add this? I’ve seen it may have something to do with the below but I’m not sure where to add this code as the fp-fact doesn’t seem to pull through a number:

<?php number_format_i18n( $number ); ?>

Thanks,

Hello there,

Thank you for getting in touch here.

In order to achieve that objective, could you please try to do the following?

  1. Open the js/main.js in your code editor, then copy the whole content of it; then paste it into js/main.min.js. So it will be more readable

  2. Replace the following code block


var counter = function() {
	$('.roll-counter').on('on-appear', function() {
		$(this).find('.numb-count').each(function() {
			var to = parseInt($(this).attr('data-to')), speed = parseInt($(this).attr('data-speed'));
			$(this).countTo({
				to: to,
				speed: speed
			});
		});
	}); //counter
};

with


var counter = function() {
	$('.roll-counter').on('on-appear', function() {
		$(this).find('.numb-count').each(function() {
			var to = parseInt($(this).attr('data-to')), speed = parseInt($(this).attr('data-speed'));
			$(this).countTo({
				to: to,
				speed: speed,
        formatter: function (value, options) {
          value = value.toFixed(options.decimals);
          value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
          return value;
        }
			});
		});
	}); //counter
};

  1. You might want to minify this JS file here

  2. Save changes. Then update through FTP or cPanel

You would need to clear your browser’s cache before reloading your site. If you site is being cached by a cache plugin like W3 Total Cache, delete all cache as well.

Let me know how it goes. I’ll wait to hear back from you regarding your stats.

Regards,
Kharis