With some help from the guys on the WP forum I managed to get this working. I have shared the code below incase anybody needs it in the future.
<?php
$field = get_field('CUSTOM_FIELD');
if ($field) {
$file = $_SERVER['DOCUMENT_ROOT'] . '/files/' . $field . '.php';
require_once( $file);
}
?>
Hi James,
Thank you for your reply.
Unfortunately, still no luck with the code 🙁
I have put the debug code in the page, and to confirm I am using the free version at the moment on this site.
http://rentals.londonmotorcycles.london/
Thank you for all of your help!
Hi James,
Thank you for your reply.
Does it matter what format I have in the ‘Save Format’ field of the ACF? I currently have dd/mm/yy.
I have tried the script that you provided me and it always outputs as if it was less than 30 days (eg: echo “30 days”) even when the date is set 2 years ahead.
If you want to see an example please look in the ‘Tax’ column here – http://rentals.londonmotorcycles.london/
It’s the first time I have had to work with dates and calculating alerts etc so I am bit baffled by it all.
Thanks for your help.
Thank you very, very much John!
Just incase anyone else stumbles upon this looking for something similar, I ended up using this code to keep it to two decimal points.
<?php
$number = (get_field('7_day_rate')/7);
echo number_format($number, 2). "";
?>