WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Pods 2.2] permalink from wrong record? (5 posts)

  1. Sheriziya
    Member
    Posted 1 year ago #

    Hey all,

    I’ve been working on my dragon cave experience site again. I’m pulling the data in a pod page now and that’s working pretty good. However, I’ve encountered one small problem. When displaying the father’s name of the dragon with a link, it’s not the link from the father, but from the mother. This is an example of what I’m working on. The first part is a simple display of all the data. In the second part you can see my tests. As you can see with the tests for the father, the name of the father is displayed correctly. However, when I tested to get a link with the name, I got the link from the mother instead of the father. Here’s the code that has to do with the subject. I haven’t copied the entire code, since it’s rather long. I've left out the table which simply displays the data and only included the table with the tests.

    I hope someone can explain why the mother’s link is used as the father’s permalink instead of the correct link, cause I’ve been going over the code so many times I don’t see it anymore.

    Also, I’ve checked the database and the permalink from the father is correct in the database. That’s why I really don’t understand it.

    I've posted this in the Official Pods forum too. I'm posting it here too because I hope the more people see it, the better a chance I have of someone knowing the cause of the problem and the solution.

    Thanks for the help!

  2. Scott Kingsley Clark
    Member
    Posted 1 year ago #

    Are the dragon father / mother fields relationships? If so, try using father.id as the field reference that you're passing into the new Pod() instance.

    http://pastebin.com/urkkxADC

  3. Sheriziya
    Member
    Posted 1 year ago #

    Yep, Father and mother are relationship fields. Both are in the dragons pod. So basically, I'm using three separate information records from 1 pod.
    I've tried your solution and this works perfectly!

    Do you think it will work too when multiple names are entered in the relationship field (partners, children)?

    Thanks again for all the help!

  4. Scott Kingsley Clark
    Member
    Posted 1 year ago #

    If multiple are set, you should be getting an array of IDs back. You'll want to use some PHP to work with the data however you see fit.

  5. Sheriziya
    Member
    Posted 1 year ago #

    Thanks for the excellent help, Scott!

Topic Closed

This topic has been closed to new replies.

About this Topic