• Resolved vesnama

    (@vesnama)


    Hello,

    I don’t know how to solve this bidirectional fields data in Pods template.

    I publish posts in 2 categories:

    • Works
    • Workings
    • I have created Pod for posts with bidirectional relationship field
      Workings for
      In which I choose from the Works list. This means that current Working post is related to chosen Work post.

      Then I created Pods template for posts.
      I added {@workings_for.post_title}

      And for Working posts it displays post title of which Work post it is related to.
      But I dont know how to solve 2 things:

      how to get this title to be an active link to related Work post
      On the related Work post how to display all Workings posts related to it

    I hope it can be done in Pods template?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Paul Clark

    (@pdclark)

    It’s difficult to give an exact specification without a Pods package export, but based on your description of the schema, these might work:

    how to get this title to be an active link to related Work post

    <a href="{@workings_for.permalink,esc_url}">{@workings_for.post_title}</a>

    On the related Work post how to display all Workings posts related to it

    Depends on the name of the relationship field. Perhaps something like:

    [if related_workings]
        <ul>
        [each related_workings]
            <li><a href="{@permalink,esc_url}">{@post_title}</a></li>
        [/each]
        </ul>
    [/if]

    Where related_workings is the name of the relationship field.

    Thread Starter vesnama

    (@vesnama)

    OK, permalink understood and working well. ??

    Second reply I do not understand.
    If in post in category Working I choose in relational bidirectional field named working_for a specific post in category Work, then how do I display in Work post all Workings related to it? I mean, there will be multiple Workings related to specific Work. So what should I do to have all related Workings listed on Work post frontend?

    Thread Starter vesnama

    (@vesnama)

    To be clearer, I am posting posts in categories “Works” and “Workings” in one post type “post”. I do not use custom post types.
    And I have one Pod extending post type “post”. This pod has relationship field “working_for” which I defined as bidirectional relationship field (and I chose in bidirectional options connection to itself).

    I must have some logical break in this process I believe but cannot understand how to solve it.

    Plugin Author Jory Hogeveen

    (@keraweb)

    It might be a good idea to view our introduction video on Pods and Pods Templates
    https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/

    This will give you a better understanding of how to work with relational data and it will provide some examples.

    Cheers, Jory

    Thread Starter vesnama

    (@vesnama)

    Ah, it seems bidirectional relationships need to be setup between different content types and not between same post type different by category?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Of course you can create relationships within the same CPT, but this is unrelated to categories.

    Thread Starter vesnama

    (@vesnama)

    Oh, I figured it out.

    Bidirectional relationship field can be used inside the same Custom post type i.e. inside the same Pod, but it needs to have 2 fields relating to each other. ??

    Thank you, you can close this topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Bidirectional relationship data in Pods template’ is closed to new replies.