Hi,
I have a custom shortcode that pulls ACF repeater fields and does timezone conversion, then prints in a list.
It works perfectly on the page, but does not fire in the pdf template.
I have tried in textarea and html object.
I have attached a screenshot of what the screenshot outputs.
Shortcode:
[dateau1]
Code:
function displayDateau1(){
if( have_rows('1_dates_&_times') ):
// Loop through rows.
while( have_rows('1_dates_&_times') ) : the_row();
// Load sub field value.
$sub_value = get_sub_field('date_&_time');
$utc_date = DateTime::createFromFormat('d/m/Y g:i a', $sub_value, new DateTimeZone('Australia/Sydney'));
$acst_date = clone $utc_date; // we don't want PHP's default pass object by reference here
$acst_date->setTimeZone(new DateTimeZone('America/New_York'));
echo '' . $utc_date->format('j M, Y g: i a') . '<br/>'; // UTC: 2011-04-27 2:45 AM
// echo '' . $acst_date->format('j M, Y g: i a'); // ACST: 2011-04-27 12:15 PM
endwhile;
// No value.
else :
// Do something...
endif;
}
add_shortcode('dateau1', 'displayDateau1');