CPT Relationships and Loopers/Dynamic Content

I’ve got a custom post type called Supplements which uses an ACF relationship filed that is linked to WP Users. For testing purposes, there is also a simple text field.

The Supplement CPT has some descriptive data, and a link.

When I try to dynamically display this data on a page called My Account the simple text field comes in and is populated as I expect, but the relationship field (supplement) does not display using {{dc:acf:user_field field=“supplement”}}

I can get it to display the post_id but it comes up blank for post_object

I’ve tried everything I know to get this to display but nothing seems to solve the dilema.

Hey @dabigcheeze,

Thanks for reaching out!

Would you mind sharing your admin credentials so that we can check your setup properly? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password
  • Page URL or Layout Builder name

You can find the Secure Note button at the bottom of your posts.

Thank you.

Hey @dabigcheeze,

Thanks for writing in! We cannot access your site because we are only seeing this:

  • See the secure note below.

The {{dc:acf:user_field field="supplement"}} dynamic content will display the post ID. What you can do is have a Looper Provider Query String and use this query: post_type= supplements&p={{dc:acf:user_field field="supplement"}}. You can then display the Supplements description and link.

Hope this helps. Kindly let us know how it goes.

I set this up as directed, but it still does not return the results I am expecting. Sorry for the lack of access. The site blocks all non North American traffic. It has now been turned off. Can you check once more please?

Hello @dabigcheeze,

I have checked your custom fields. It is best that you change the return format from post object to post ID instead.

And then in your My Account page, you need to have a Looper Provider Dynamic Content with the following {{dc:acf:user_field field="supplement"}}.

Screen Shot 2022-06-26 at 2.02.07 PM

You will have to display the Supplements title and description like the post items.

Hope this makes sense.

Appreciate the help. I responded securely as well due to the provided code not delivering what your screen capture shows. My test section above shows the IDs as previously discussed but the section you built is not as you show it.

Hey @dabigcheeze,

Sorry for the confusion! The return format should be set Post Object not Post ID. I went ahead and change it for you then it is now showing properly on your my account page.

ACF Page:

Backend My account Page:

Frontend My account Page:

Hope that helps.

Hi, and thanks for all the help. 110% appreciated and the reason you guys are the only theme I’ll use.

Hi @dabigcheeze,

Glad that we are able to help you.

Thanks

Further to the resolved display issue, how can I hide this section if a user does not have a supplement field populated?

I tried {{dc:user:meta key="_supplements"}} is not EMPTY as a condition. I also tried a few other combinations of conditiobs but nothing seems to work.

Hello @dabigcheeze,

Add a condition in your Looper Consumer that it will only display if there are some output from the Looper.

Hope this helps.

I responded privately to this last week but nobody got back to me. This does not seem to work to hide the entire section that the process is a child of. The section stays visible. I put the condition on the parent that uses the Looper Provider. Ideas?

Hello @dabigcheeze,

I have investigated the issue and I believe that this a bug between the ACF field and the Looper Condition. I will be reporting this to our developers. I cannot guarantee a fix at this moment. It is best that we wait for the developers to resolve the issue.

Please bear with us.

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