Daily Schedule
-
Can I use this plugin at two scheduled times every day? Im interested to use force refresh to clear cache of browsers using cookeies for a specific page once at 8:30am and again at 4:30pm every day. Is this possible? Specifically, is tihs possible without the need to script a cron job to make it work?
- This topic was modified 3 years, 8 months ago by David.
The page I need help with: [log in to see the link]
-
I found a solution since @ruanna asked. Until if or when this plugin adds this feature, here’s what Im doing –
I installed and activted the Header Footer Code Manager (HFCM) plugin by 99 Robots and added the below php for 1800 seconds aka 15 minute intervals to a specific page of my site ie page id for me being 5539.
<?php if(is_page(5539)) { echo ‘<META HTTP-EQUIV=”REFRESH” CONTENT=”1800″>’ ; } ?>
If running another plugin is something you don’t want to do or php is too intimidating you can instead html below to your header.php or use the mentioned HFCM –
<meta http-equiv="refresh" content="1800">
To flush cache I installed and activated the WP Fastest Cache plugin and added extra settings as seen with the screenshot below –
For a specific date and time without waiting to use code, I was using “Widget Visibility Time Scheduler” By a German developer at Kybernetik Services together with “Widget Shortcode” plugins with no issues but my site got malware and had to restore it and now I cant get it working but it’s due to the malware.
The site has been repaired and is backup but unfortunately, I used an older backup to restore and needed something quick so I used PHP while I figure out how to get this plugin to work again.. OR such time Force Refresh adds a schedule feature. #fingerscrossed
You can find “Widget Visibility Time Scheduler” in the new plugin search box after clicking the “Add New” button on the plugins page.. But, For each day to have a set start and stop you need to pay for the pro version for something like $20 USD you can find below. I thought it was well worth the money when I had it working, I just dont have the time to connect using my purchase key for them to send me the newer pro version so I can set it up but it’s reltaively easy.
More managable than code and more viable than running Force Refresh manually.
I would be willing to shell out a cost something similar or less to get it with Force Refresh.
Widget Visibility Time Scheduler Pro
- This reply was modified 3 years, 8 months ago by David.
Thanks for all that info David, so many good tools and ideas out there. And paid plugins are so often worth it.
‘Great minds’ as they say, last night I also thought of <meta http-equiv=”refresh” content=”whatever”> – I use Astra theme and its custom layouts can be created as hooks. Add the post scheduler plugin and you can set a wp_head hook containing <meta http-equiv=”refresh” content=”whatever”> to publish at a certain time.
I really thought my set up might work, but no. The wp_head hook published on time but a manual page refresh was required for my browser window to know about it.
A scheduled Force Refresh “click” would fix the issue I think.
You’re right, same here. PHP can’t tell the browser what to do on it’s own, but Javascript can!
After a few late nights and early mornings, my production site is using this and wouldn’t ya know, just 16 minutes ago AT 8:46am CST, it triggered and automatically refreshed the MS Edge, Firefox and Chrome browsers I had open for testing upon the scheduled time I have it set for 8:30am CST.
I suspect the copied code I used to duplicate a 4:30pm CST refresh will occur in 7 hours and 59 minutes from now.
An effective substitute for if or when the Force Refresh plugin develops a schedule tool.
The script tag below works using the cited Header Footer Code Manager plugin –
<script> function refreshAt(hours, minutes, seconds) { var now = new Date(); var then = new Date(); if(now.getHours() > hours || (now.getHours() == hours && now.getMinutes() > minutes) || now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) { then.setDate(now.getDate() + 1); } then.setHours(hours); then.setMinutes(minutes); then.setSeconds(seconds); var timeout = (then.getTime() - now.getTime()); setTimeout(function() { window.location.reload(true); }, timeout); } refreshAt(08,30,0); //Will refresh the page at 8:30am </script>
Darnit, that is not working for me – I’ll keep playing with it though. I even tried implementing with header/footer plugin.
Question before I move on re: this line right here –
then.setDate(now.getDate() + 1);
Does + 1 by any chance mean tomorrow? (I obviously do not know javascript.) I bet you’d have mentioned if so.
Either way, thank you for sending solutions @lutchenpc
@ruanna Yes, +1 does mean tomorrow. Below are some other related JS date and time methods including constructor properties that returns it’s function
var today = new Date('12/31/2015'); var tomorrow = new Date(today); tomorrow.setDate(today.getDate()+1); tomorrow.toLocaleDateString();
JS Date constructor getDate() getDay() getFullYear() getHours() getMilliseconds() getMinutes() getMonth() getSeconds() getTime() getTimezoneOffset() getUTCDate() getUTCDay() getUTCFullYear() getUTCHours() getUTCMilliseconds() getUTCMinutes() getUTCMonth() getUTCSeconds() now() parse() prototype setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() setUTCDate() setUTCFullYear() setUTCHours() setUTCMilliseconds() setUTCMinutes() setUTCMonth() setUTCSeconds() toDateString() toISOString() toJSON() toLocaleDateString() toLocaleTimeString() toLocaleString() toString() toTimeString() toUTCString() UTC() valueOf()
Did you take the code from my previous post to cut and paste as is but only to amend the scheduled (see below) to something like a minute or two after the current time you save it to see if it works? The code shows 8:30am as what I needed it for and what I have it set I used as an example istead of zeros. I know it’s a dumb question but its the small stuff such as that which causes most problems.
refreshAt(08,30,0);
I assume you put it in the header of the heaer/footer section right, and the snippet you used was set to active? See screenshot link below for my settings. I use the same script for both scheduled times just changing the “refreshAt” time.
Thanks @lutchenpc. I definitely took your code exactly and adjusted the time to match our circumstances. Or at least I thought I did.
Let me know if this makes sense to you:
The client is in USA Eastern time, and I’m in USA Mountain time, so their time is always 2 hours ahead of mine. 2pm my time = 4pm theirs. Their main WP site settings reflect their time zone – East Coast.
I set up the refresh time in their time zone – thinking if I want to refresh at 12:50 here, I’d need to set the test refresh for 14:50. I watched – no refresh.
Since then I figured out that it fires reliably if I set it to trigger in MY time zone. I can work with that, just – seems odd.
- The topic ‘Daily Schedule’ is closed to new replies.