Tagged: post-relate
- This topic has 6 replies, 2 voices, and was last updated 7 years, 11 months ago by
Jason.
-
AuthorPosts
-
-
February 20, 2014 at 6:25 pm #1432
JasonKeymasterI have an interesting situation:
There are two post types:
– People
– StoriesPlease 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?
-
February 24, 2014 at 12:29 pm #1451
JasonKeymasterStill 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.
-
February 24, 2014 at 4:38 pm #1452
JasonKeymasterI 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.
-
February 24, 2014 at 6:05 pm #1453
-
February 24, 2014 at 6:11 pm #1454
JasonKeymasterCorrect. 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.
-
February 25, 2014 at 1:28 pm #1459
-
February 25, 2014 at 4:57 pm #1463
JasonKeymasterSounds good, Steve! Thanks!
-
-
AuthorPosts
- You must be logged in to reply to this topic.