Looper: Display Title from ACF Post Object

Hi–I’m building an Awards page, which loops over the “Award” custom post type and displays the award title and details entered in ACF. On each Award post, a related project (from the “Project” custom post type) can be selected via an ACF Post Object field.

The first looper works fine and outputs all awards, however, per the Loopers documentation, I’ve looped over the post object field (“Related Project”), and I can’t seem to get the project title to display

Current layout is:

Row (Loop Provider for Awards)

Column (Loop Consumer for Awards)

Grid

Grid Column 1 (Award image)
Grid Column 2 (Award Text)

Div (Loop provider for Related Project field - {{dc:looper:field key=“related_project”}})

Text (Intended to be Related Project Title & Link)

In that last Text element, I’ve tried using {{dc:post:title}} which outputs the Award title, not the Project like I want. On the Div element, I’ve also tried the input {{dc:acf:post_field field=“related_project”}} but that does not seem to work either. How might I access and display the title and URL from the Post Object that that is returned for each award?

Hi @2020creative,

Thanks for reaching out.
It will be very difficult to understand the problem without investigating the Looper and the ACF structure made on your website. I would suggest you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

I would also request you go through the following article and the video related to the ACF and the Looper.



Thanks

Yes, apologies—I realize now that probably sounds a bit convoluted! I added a secure note with login credentials and a link to the specific page.

I have reviewed those docs and that particular video per another thread that I found, and I got as far as looping over the particular post object that is called in ACF. However that video only shows a particular use case for pulling an image from a User, so I was not sure where to go from there or what the correct key/field would be to get the title and URL from said post object.

Hi @2020creative,

Your structure is almost perfect to get the post related object title, the only problem is the dynamic content you added in your looper provider. Your code is {{dc:looper:field key="related_project"}} but the right dynamic content is {{dc:acf:post_field field="related_project"}} and to add links to your post related object title, just add {{dc:post:permalink}} to your href.

Reference:

Hope that helps.

Thanks so much Marc, that works perfectly!

Hi @2020creative,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

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