Skip to content

Having trouble accessing component fields through another page's relationship field. #404

Answered by DavidZudu
DavidZudu asked this question in Q&A
Discussion options

You must be logged in to vote

Ok I figured it out. For Flynt specifically, its likely your fields are technically inside Flexible Layout fields, so you need to loop through your Flexible Layout and find the correct Components, then you can reference the fields: here in the docs

{% for post in relationshipField %}  // get the selected posts from the relationship/post object fields
    {{ post.title }} // This works like you would expect
    {% for content_block in pageComponents %} // Loop though each layout block used in you flexible layout
        {% if content_block.acf_fc_layout == 'blockSummary' %} // Getting the correct layout
            {{content_block.summaryText}}  // It works!
        {% endif %}
    {% endf…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@DavidZudu
Comment options

Comment options

You must be logged in to vote
3 replies
@aaronmeder
Comment options

@marcotiberio
Comment options

@comsup
Comment options

Answer selected by DavidZudu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants