Problem: I have a post reference custom field and I would like to access the reference post's title and ID in PHP.
Solution:
Use get_post_meta to determine the reference post ID, then use get_the_title to determine the reference post title:
$contributor_id2 = get_post_meta( $post_id, "wpcf-post-contributor2", true); $contributor_id2_title = get_the_title( $contributor_id2 ); echo "Post ID: " . $contributor_id2 . ", Title: " . $contributor_id2_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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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 3 Antworten, has 2 Stimmen.
Last updated by Christian Cox vor 5 Jahre, 10 Monate.
Assisted by: Christian Cox.