Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
To make it simpler does anyone know of a plugin or program that will automatically post text at a specified time?
Thangs again
This is just an idea that may or may not work, you will have to test it out for yourself and make sure it works for you:
Use the PHP date function to get day of week
http://www.php.net/manual/en/function.date.php
When the day of week changes (that will be at midnight) create a new random number.
Use PHP rand function or mt_rand to generate the 8 digit number
http://www.php.net/rand
http://www.php.net/manual/en/function.mt-rand.php
I find mt_rand is more random, better to use it than rand.
You havent specified how you want to place it on your site, eg on a few pages, all pages, in the body, in the header, etc and that will depend whether you should write a plugin, a shortcode, or create a page template.
Keep in mind that midnight will be the midnight on your website server and may not be midnight for a user in a different time zone.
Hope this helps 🙂