I am trying to: Get a start-date and end-date field to display correctly in a PHP template.
This was working and I was using:
<?php echo (types_render_field( 'start-date', array() ));?> - <?php echo (types_render_field( 'end-date', array() ));?> where start-date is the name of the start date custom field and end-date was the custom field for end date custom field.
I have no idea why this would suddenly change.
I checked out this post on the support forum:
https://toolset.com/forums/topic/displaying-date-field-information-in-php-template-file/
and see that the code was slightly different so I tweaked my code to:
<?php echo types_render_field( 'start-date', array('format'=>"M d") );?> - <?php echo types_render_field( 'end-date', array('format'=>"M d") );?></p>
But it still doesn't work. You can see this specifically on the archive-workshops.php file on line 16.
The site is password protected so if you open a private message I can give you access.
In the meantime see my attached screengrab - the dates should appear in the green strip with the calendar icon.
Thanks for your support!
Hi, there's currently a known issue with types_render_field and formatted dates:
https://toolset.com/errata/types-fields-are-not-displayed-properly-using-types_render_field/
As a temporary fix, you can add 'style'=>'text' to the arguments array, or you can apply the patch mentioned in the post above.
Thanks for your quick response Christian.
FYI we have 4 sites currently in development that all use this functionality so we're reluctant to start patching with temporary fixes if you have a new release coming out with a fix.
Can you confirm this will be fixed in the next release and when the next release is due?
Thanks,
Guy
I can't confirm the release or release date with certainty yet, but the fix is currently being tested in QA. Right now it looks likely it will be included in the next release, but I can't guarantee that or a timeline for delivery.
This issue has been resolved in Types 3.0.7, which is now available for download or automatic update.
Thanks for letting us know Christian.
We've now updated across all our sites now and confirm the fix is working!