Skip Navigation

[Resolved] Custom field name

This thread is resolved. Here is a description of the problem and solution.

Problem:

Render custom date field value with PHP codes in front-end.

Solution:

Types plugin will per-pend slug "wpcf-" before the field slug, you can try with Types API function types_render_field() to render the custom date field value without slug "wpcf-"

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/functions/#date

100% of people find this useful.

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by JamesS2731 6 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1145191

Tell us what you are trying to do? Get WP FullCalendar to use a Toolset post field rather than the default post date.

We're trying to display products (courses) and a calendar. We added a post field for the start date and are hoping to use the WP FullCalendar plugin as the method of display. There's very thin pickings when trying to find a calendar to show WooCommerce products (rather than Events, etc.)

Is there any documentation that you are following? - This page references ACF but I'm presuming that I can do the same thing with a Toolset post field - https://wordpress.org/support/topic/show-date-by-acf/#post-9120000

Is there a similar example that we can see? - This is the dev age which shows the products but by post date, not course date (the post field) - hidden link

What is the link to your site? - hidden link

The slug for post field we want to use is 'display-date-from'.

I changed the suggested code as follows:

$acf_date = get_field('display-date-from');
$post_date = substr($acf_date, 0, 10);
$post_timestamp = strtotime($acf_date);

But it doesn't work. As I recall, dont the Toolset post fields have a prefix when used in situations such as this?

I look forward to your thoughts.

Kind regards
James

#1145571

Dear James,

You are right, Types plugin will per-pend slug "wpcf-" before the field slug, you can try with Types API function types_render_field() to render the custom date field value without slug "wpcf-", see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date
click link "Repeater attributes, User attributes, Term attributes, Usage examples", there

#1145828

My issue is resolved now. Thank you!