Support

Account

Home Forums General Issues How to display field value form one post on other?

Helping

How to display field value form one post on other?

  • I have two posts, let’s call them post A and B. Now, in post A I have field with name ‘link’ which is ‘relation’ or ‘post object’ type. In this field I’m selecting the post B. Now, on B post I want to display the same field type (so ‘relation’ or ‘post object’) but with reference to post A. It’s sounds complicated, but I need it for this situation:

    Post B is a ‘event’ post type. Post A is a product in Woocommerce, ‘event ticket’. On ‘event ticket’ I set which one event this ticket concerns. Then, on post A (event) I want to display ‘woocommerce_single_product_summary’.

    How should I do it in the best way?

  • Use a plugin that creates bidirectional relationships between the two post types or use this example to build it https://www.advancedcustomfields.com/resources/bidirectional-relationships/, then on the event page you can get the relationship field on that end to show the related product.

    Or you can do a reverse relationship query as explained here https://www.advancedcustomfields.com/resources/querying-relationship-fields/

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

The topic ‘How to display field value form one post on other?’ is closed to new replies.