2 added 7 characters in body; edited tags
source | link

If I have something like the following in my single.php file (as a very basic example):

<?php
$a = the_field('test1'); ?>
$b = the_field('test2'); ?>
$c = the_field('test3'); ?>
$d = the_field('test4'); ?>

$New_data = $a * $b * $c * $d;
?>

How can I use Cron to calculate $New_data on a daily basis instead of on every page refresh? In all the cron tutorials I've read, they say to use wp_schedule_event in the functions.php file, but I'm not sure how to apply that as the calculations are based on the post being viewed and not a global calculation.

Any helpsuggestions will be greatly appreciated, been stuck on for hours!

If I have something like the following in my single.php file (as a very basic example):

<?php
$a = the_field('test1'); ?>
$b = the_field('test2'); ?>
$c = the_field('test3'); ?>
$d = the_field('test4'); ?>

$New_data = $a * $b * $c * $d;
?>

How can I use Cron to calculate $New_data on a daily basis instead of on every page refresh? In all the cron tutorials I've read, they say to use wp_schedule_event in the functions.php file, but I'm not sure how to apply that as the calculations are based on the post being viewed and not a global calculation.

Any help will be greatly appreciated, been stuck on for hours!

If I have something like the following in my single.php file (as a very basic example):

<?php
$a = the_field('test1'); ?>
$b = the_field('test2'); ?>
$c = the_field('test3'); ?>
$d = the_field('test4'); ?>

$New_data = $a * $b * $c * $d;
?>

How can I use Cron to calculate $New_data on a daily basis instead of on every page refresh? In all the cron tutorials I've read, they say to use wp_schedule_event in the functions.php file, but I'm not sure how to apply that as the calculations are based on the post being viewed and not a global calculation.

Any suggestions will be greatly appreciated, been stuck on for hours!

1
source | link

Using cron for multiple queries

If I have something like the following in my single.php file (as a very basic example):

<?php
$a = the_field('test1'); ?>
$b = the_field('test2'); ?>
$c = the_field('test3'); ?>
$d = the_field('test4'); ?>

$New_data = $a * $b * $c * $d;
?>

How can I use Cron to calculate $New_data on a daily basis instead of on every page refresh? In all the cron tutorials I've read, they say to use wp_schedule_event in the functions.php file, but I'm not sure how to apply that as the calculations are based on the post being viewed and not a global calculation.

Any help will be greatly appreciated, been stuck on for hours!