# Localized Number Shortcode

> Adds a [wpide_number] shortcode that prints a number with the thousands and decimal separators of the current language, for example 1,234.5 or 1.234,5.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: numbers, locale, shortcode
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/i18n-localized-number-shortcode/

## Code

```php
add_shortcode( 'wpide_number', function ( $atts ) {
    $atts = shortcode_atts( array( 'value' => 0, 'decimals' => 0 ), $atts, 'wpide_number' );

    return esc_html( number_format_i18n( (float) $atts['value'], min( 6, absint( $atts['decimals'] ) ) ) );
} );
```

## Notes

Use [wpide_number value="1234.5" decimals="1"].

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Localized Number Shortcode" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
