Support » Plugin: Pods - Custom Content Types and Fields » Templates + Multiple Data + always shows the same title

  • Resolved littleweewebsites

    (@littleweewebsites)


    Hi there,

    I have a relationship for a pod called project scopes, with gd_companies from Geodirectory.

    In my projects tab I am trying to list projects for a specific company, and it is working, only the titles are all coming back the same.

    This is the code:
    <p>Scope: {@company_name.project-scopes.post_title}</p>
    <p>Project: {@primary_project.post_title}</p>
    <p>Dates: {@start_date} – {@end_date}</p>
    <hr />

    The dates are coming back correctly, and the amount of records is right, its just the title that is coming back as a duplicate of the first record.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jim True

    (@jimtrue)

    Unless that is a single select relationship, that traversal isn’t going to work because you’re basically saying ‘only give me the first match’. None of the rest of that statement is looping through the projects, either, so if the result is a ‘list’, it will provide it back as a list of items.

    You need to be using an [each company_name] or an [each project_scopes] to loop through your related records; I can’t tell from your configuration where the relationship actually starts or ends, but it also looks like you’re trying to traverse two levels in one connection.

    If you’re working on a specific company, are you on the post for that particular company? If you are, then you would do:

    
    [each project_scopes]
    <p>Scope: {@post_title}</p>
    <p>Project: {@primary_project.post_title}</p> << this appears to be a relationship inside project_scopes
    <p>Dates: {@start_date} - {@end_date}</p>
    <hr />
    [/each]
    

    Check out the video for Grow Beyond Posts & Pages:
    https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/

    littleweewebsites

    (@littleweewebsites)

    Awesome, got this working, thanks Jim.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Templates + Multiple Data + always shows the same title’ is closed to new replies.