Site logo

Archived topic

Show content from ACF relationship field

11 replies · Started by Jens on March 20, 2023

Viewing posts 1–12 of 12

Dear Generatepress team,

I am trying to use the GB Query Loop to show featured image, title and excerpt from custom post type (education) that is linked via an ACF relationship field in another custom post type (jobs) one each job's single.

I have tried to use https://generatepress.com/forums/topic/acf-relational-field-output-via-generateblocks-dynamic-data/. Can you give me some more information how to get this to work.

Thanks in advance.

Hi Fernando, thanks for the quick reply. I have checked the implementation again. Unfortunately it is not working according to the instructions.

It would be great if you could have a look. You find more info in the private information. Many thanks in advance!

Can you try placing the Relationship field outside the Group field?

Thanks for the tip. I have placed it outside the group field. Now the field is also directly show in the dropdown options of "Post Meta Field". But it still does not show anything on the single.

Hi there,

in the code snippet, immediately after this line:

$relationship = get_field( $relation, $queried_object );

Can you add:

var_dump($relationship);

This will dump that variables value to the page, so we can then see what is inside it.

Thanks! Done.

So thats nothing then :)

Try changing this line:

$relationship = get_field( $relation, $queried_object );

to:

$relationship = get_field( $relation );

Thanks for the effort so far! Unfortunately that did not do the trick. Do you have any further ideas? Thanks in advance.

Hi Jens,

To test, can you try creating a new Relationship field, and test the code on this new one?

Make sure to set a value for it on the CPT you're testing.

Hi Fernando, that also does not work. I will reach out to a developer to have a deeper look. Thanks for your support.

I see. You're welcome, Jens!

This archived topic is closed to new replies.