Add comma separator for numbers in the Counter Widgets
in Shortcodes
Is there anyway to format the Counter Widgets so they show commas in the numbers such as 5,000 instead of 5000?
Comments
"Sorry but this is not possible. Counter works on math and is not able to count when have different symbols then only numbers."
You could add an option in the element configuration to "apply english formatting". Your counter/animation loop that iterates the number through the determined range could be filtered through code below that alters the output of the numbers before writing it to the html element containing it. The math would not be adversely affected because it's processing some original range of numbers to animate from X to Y, but you'd just apply the user-specified number format. The user would still need to enter like 2 and 180000 as the range, and you'd take care of the commas on the output.
If you can access the numbers from the animation loop in PHP, you'd use:
If you must access them in javascript, you'd use:
Hi @haveabyte,
Thank you for your message.
We have this topic on our feature request list, and we will surely take this into account.
Best regards