I want to reload/refresh a (WordPress) webpage at specific times during a day. So no exact/specific intervals that you can do with <?php header("Refresh:60"); ?>
or the javascript function setInterval()
.
For example I want to reload the page only at these times: 08:30 09:00 09:15 14:20
I want to solve this with PHP or jQuery/JavaScript.
Example of my code (WordPress):
<?php
// Get Start time and End time from Wordpress using Custom Fields
$sessionTimeStart = get_field('session_time_start');
$sessionTimeEnd = get_field('session_time_end');
$sessionTitle = get_the_title();
$sessionContent = get_the_content();
// Current time
$currentTime = current_time('H:i');
if($currentTime > $sessionTimeStart && $currentTime < $sessionTimeEnd) {
// Prints info about the specific session
echo $sessionTitle;
echo $sessionContent;
}
?>
Any suggestions?