A WordPress plugin that displays a random number on each page load. It truly is magic.
Here is a random number: 28
See? It works.
Get the Plugin
The plugin is available free on WordPress.org, or search for A Random Number under Plugins – Add New in the WP Admin. A premium version is in development which outputs a random universe on any WordPress page.
To add a random number, just use the shortcode
[arandomnumber] on any page, post, widget, or anywhere on your site. If you need to call the plugin from a page template, use the do_shortcode(); function, like this:
<?php echo do_shortcode('[arandomnumber]'); ?>. You can add it as many times as you like on a page. Each time it’s called, it will display a unique random number.
[arandomnumber] shortcode accepts the following attributes:
- min: Minimum number in range. Usage: min=1. (Optional. If used, the max attribute is required. Must be smaller than max. Default value 1.)
- max: Maximum number in range. Usage: max=100. (Optional. If used, the min attribute is required. Must be larger than min. Default value 100.)
- comma: Option to display or remove commas in the number. Usage: comma=no.(Optional. Default value yes.)
By default, the random number will have a range of 1 – 100. You can change the range of the random number by using min and max attributes:
[arandomnumber min=1 max=10000]: This will output a random number between 1 and 10,000. (Like this: 8,394)
[arandomnumber min=-500 max=-1]: This will output a random number between -500 and -1. (Like this: -181)
[arandomnumber min=50000000 max=60000000]: This will output a random number between 50,000,000 and 60,000,000. (Like this: 50,111,345)
[arandomnumber min=10000 max=20000 comma=no]: This will output a random number between 10,000 and 20,000, without the commas. (Like this: 13828)
Negative numbers are allowed. The total range of allowed numbers is really big. I tried a number with 27 characters and it still worked. Woah, that’s a lot of numbers. Just make sure min is smaller than max or you may break the Internet.
A Random Number Button
If shortcodes are too scary you can also use the A Random Number buttons on the Visual or Text tabs:
On the Visual tab, clicking it will open this pretty little window:
Add your values, or leave them blank, then press OK to add the random number. On the Text tab, pressing the button will add the shortcode with the min and max attributes. This is a shortcut so you don’t have to type it every time. Aren’t we nice?
Alright, that about covers it. Got it? Good.
Why on Earth would you need support for this plugin? Well, if you insist, please submit a ticket on the plugin’s page on WordPress.org, or leave a comment below. Please allow at least one eternity for us to get back to you.
v1.1: August 19, 2017
- Added comma attribute to remove commas if needed.
v1.0: January 7, 2016
- Launched A Random Number into the Internets. It’s alive!