Home › Forums › General Issues › Show Custom Field results from one post type in template of another › Reply To: Show Custom Field results from one post type in template of another
I just had a similar problem where I wanted to pass data from one page template to another. I connected the 2 pages via drop down menu of all the pages on the site. In your case, your drop down menu would accommodate posts instead of pages.
If I understand your problem, you want to avoid adding duplicate info on your ARTIST post because it’s already been entered on the RELEASES post. So you could enter the data on the RELEASES post and then connect to the RELEASES post by using a drop down menu on the ARTIST post.
Here’s what worked for me– thanks to Jamie and Elliot for showing me how to do this.
and here it is copied from that bulletin board page:
Get field data from another page via drop down menu:
Page A (master page)
Page B (sub-page): Linked to Page A via drop-down menu
Create a post object field on Page B’s ACF called ‘select_page’
In order for Page B to access field data from Page A:
Add something like this in Page B’s php code:
<? $pages = get_field('select_page');
get_field('content_from_page_A', $pages->ID);
?>
You can have as many get_field(‘content_from_page_A’, $pages->ID) as you need where ‘content_from_page_A’ is the name of any field on the RELEASES template and $pages->ID gets the page ID number of the RELEASES page as defined by the drop down menu of pages (or posts in your case).
$pages->ID is what hooks the two templates together. If we weren’t using a variable, the syntax would look like this:
get_field(‘content_from_RELEASES_page’, ID of RELEASES page)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.