Tagged: 

Viewing 6 reply threads
  • Author
    Posts
    • #1432
      Jason
      Keymaster

      I have an interesting situation:

      There are two post types:
      – People
      – Stories

      Please ignore suggestions such as using Users and Post instead. There’s a reason I’m doing it this way; I’m not providing the whole picture.

      Stories has two fields that point to people: Author and People Involved.

      What’s interesting is that when I do a get_posts for people involved in the story, I get all the people related (author and people involved). The question is, how would I discern between whether a person was related via the author field or the people involved field?

    • #1451
      Jason
      Keymaster

      Still really hoping to hear any thoughts on this. Perhaps it’d be useful to add an additional column to the wp_post_relationships table that stores the field name that inserted the relationship?

      In the meantime, I’m at a bit of a loss. I could store the ID as a post meta, but then I lose the bi-directional relationship.

    • #1452
      Jason
      Keymaster

      I came up with a workaround.. that I’m not crazy about, but it works.

      I added a hidden field that stores the id for the specific field in the wp_postmeta table. I can then check the relation against this meta-value to see which field it belongs to.

    • #1453
      Steve
      Keymaster

      @jason– Sorry for the delayed response. So you have TWO Relate fields for Stories CPT that point to Users CPT?

    • #1454
      Jason
      Keymaster

      Correct. One is an “Author” (single People CPT using select-relate field I made) and the other is “People Involved” (multiple People CPT using post-relate field). If I mark a person as Author and update the post, it will then show that person as the Author AND in “People Involved”, since it doesn’t differentiate.

      I know it’s a strange case, but this has been an interesting project.

    • #1459
      Steve
      Keymaster

      @Jason– This is a really interesting use case. As we finalize the relate field we will make sure this type of functionality exists.

    • #1463
      Jason
      Keymaster

      Sounds good, Steve! Thanks!

Viewing 6 reply threads
  • You must be logged in to reply to this topic.