How can I automatically set all posts to 00:01am for the following Monday morning?
(Modified version of a question I answered in the WordPress support forums at http://wordpress.org/support/topic/59803)
This is something that I quickly hacked together. I’ve never actually tried plugging anything into the Admin interface to over-ride/replace anything, so for the moment it’ll stay as a quick hack.
Open up and Edit wp-admin/admin-functions.php, we’re going to put a new function in there.
function get_next_week
($tint) {
$weekdayid =
date(“w”,
$tint);
$startoftoday=
mktime(0,
1,
0,
date(“n”,
$tint),
date(“j”,
$tint),
date(“Y”,
$tint));
return $startoftoday +
((8 -
$weekdayid) *
86400);
}
Now, Find the ‘touch_time’ function and in particular the line that says:
$time_adj =
time() +
(get_settings
(‘gmt_offset’) *
3600);
Change it so that it looks like:
// $time_adj = time() + (get_settings(’gmt_offset’) * 3600);
$time_adj = get_next_week
(time());
This will cause all posts to default to 00:01 on the following monday. If you want to change that particular date/time, play with the get_ext_week function defined above.