Support

Account

Home Forums General Issues Use value from relationship field in custom post type

Solving

Use value from relationship field in custom post type

  • Post type A has a relationship field that gets the URL of a link to a file from Post type B. I want to use the URL from the relationship field as the href for Post type A’s title. There are multiple posts from Post type A output in an ul. Thanks for any help.

  • I got there by storing Post A’s field’s in variables, then in the same loop started the foreach loop as prescribed by ACF, also storing the results from Post B in a variable. Then just echo’d it all out in an ul.

    If there is a better way I would still be interested in hearing it. Thanks.

  • Hi @seasterling

    Not sure I follow your explanation of setup..

    So you have a post type A which has a relationship field where you select one or more of post type B. And when you’re on post type A you want to fetch a file url from each post type B connected to the post type A and link the post title to the file?

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Use value from relationship field in custom post type’ is closed to new replies.