This is basically a follow-up question to my last ticket. I have the post reference field "tarif" referring to a CPT named honorar. In this CPT I have custom fields like hourly, weekly, monthly, and I want to show those values.
<tr>
<td>Tarif</td>
<td><?php $tarif = types_render_field( "tarif" ); $title = get_the_title($tarif); echo ucwords ($title); ?></td>
</tr>
This works fine now thanks to Christians help. But now I would like to also show for example
<tr>
<td>Stunde</td>
<td><?php $hourly = types_render_field( "hourly" ); echo ucwords ($hourly); ?></td>
</tr>
The thing I need help with please is how to query that, seeing it is in a referenced CPT and not the one I am currently in.
I was thinking maybe something like this? But I cannot make it work right now.
$post = $tarif;
setup_postdata( $post );
I hope I could explain well enough what I am trying to do. Thanks for the help.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Alexander,
You can simply do this.
<td><?php $hourly = types_render_field( "hourly", array( 'item' => $tarif ) ); echo ucwords ($hourly); ?></td>
This should give you the value from the post in the $tarif variable.
Please let me know if this helps.
Thanks,
Shane
My issue is resolved now. Thank you!