ACF Relationship - Show custom fields

Hello - im 90% of the way there but to bring you up to speed:

I have two custom post types

Product and Coupons

My goal is to share ACF field data (in a looper) from Coupons post type to my Product post type - with the help of a Relationship field.

So for my Product post layout to have a looper that pulls in ACF custom field data from the Coupon posts via relationship field association.

So to follow on from my progress - i’ve followed this and can replicate the end result of showing all Coupon post titles on my Product page that have a relationship in a Looper - HOORAYY

Im stuck at the last hurdle of referencing an ACF field from the Coupon post type.

I can reference the Coupon custom post title easy enough with:

{{dc:post:title}}

I’ve used this dynamic content to try and do this:

{{dc:post:coupon_title}}

{{dc:post_field field=“coupon_title”}}

{{dc:post:meta key=“coupon_title”}}

{{dc:looper:field key=“coupon_title”}}

{{dc:acf:post_field field=“coupon_title”}}

{{dc:acfp:post:meta key=“coupon_title”}}

{{dc:acfp:looper:field key=“coupon_title”}}

Hi Jack,

To display your ACF field from your coupon post type to your Product Layout, just use this dynamic code {{dc:acf:post_field field="coupon_title"}}

Hope that helps.

Thank you.

Ahh easy - Thanks!

Next question,

How could I list the looper fields inline - within a paragraph?

E.g.

This is a list of my Coupons: {{dc:acf:post_field field=“coupon_title”}} that you can Claim.

When I try to do this, of course, it will loop all of the text in the field, not just the relationship fields.

The fast fix I can see is to create three text boxes next to each other. But this in turn creates three divs and is probably not great when crawled.

Thanks

Hi Jack,

I have investigated the specific layout and didn’t find the issue described in your last post. Can you please provide any screenshot of it.

Thanks

To make my request more clear,

I’ve added text before the dynamic text content for my ACF field. - {{dc:acf:post_field field=“coupon_title”}}. Which in turn is looped to for all found fields (as per the example image).

My question is - is there a method of wrapping the dynamic content so that it loops only this data, and not the text before and after.

Or would I need to create three separate text boxes with the before and after text box set to be ‘not a consumer’.

Hope that makes more sense.

Hi Jack,

You need to create three separate text boxes in order for you to attain your goal. Here’s how it goes.

First Box = Before
Second Box = Dynamic Content
Third Box = After

Hope that helps.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.