In some point of view when we developed a custom WordPress plugin or theme, we have to notify users for any urgent update, error or any custom message on WordPress admin section. All this done by admin_notices hook function.
Just few days back i got a request for my client to making a script that Increment Number with random interval. Then i thought to make a small plugin that generates random interval. How it works, is start number increments with a default value (1000) and set a cookie to user’s browser and every time this script update the cookies value so that when the user refresh there browser he/she get the same last incremented value. You can control the setTimeout random interval to change the value in the following line
var rand = Math.round(Math.random() * (2000 - 200)) + 200;
Short and effective script to generate random hex color. We start with random number to multiply with white color (Hex Code is 0xFFFFFF ), now we have to convert the random generated values into the hexadecimal value to display the color. To convert integer values into hexadecimal i have used
.toString( radix ) where:
- 2 – The number will show as a binary value
- 8 – The number will show as an octal value
- 16 – The number will show as an hexadecimal value
We are going to implement the AjaxForm plugin for image upload with progress bar. First of all decorate your upload button according to your need if you want. Just take a look on the CSS section that helps to decorate your upload button and some other necessary stuff that helps you to display the progress bar.