Problem: I would like to display the title of the post selected in a post reference field using PHP, but when I output the value of types_render_field I get a number.
Solution: This number is the referenced post ID. You can use it to get the post title with the WordPress function get_the_title:
$tarif = types_render_field( "tarif" ); $title = get_the_title($tarif); echo ucwords ($title);
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://developer.wordpress.org/reference/functions/get_the_title/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 3 years, 5 months ago.
Assisted by: Christian Cox.