Timeline for WP Query—Relationship between two custom post types and their fields
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 5, 2017 at 21:07 | comment | added | nickpish | Just a note to follow up-- with some slight variations, this ended up working pefectly! Thanks @rudtek | |
Apr 5, 2017 at 21:06 | vote | accept | nickpish | ||
Apr 4, 2017 at 5:17 | comment | added | nickpish | Ha ok, I'll try and report back! | |
Apr 4, 2017 at 5:15 | comment | added | rudtek | should. I'm on pins and needles waiting to find out! | |
Apr 4, 2017 at 5:15 | comment | added | nickpish | Ok thanks-- in my case the main fields are all post objects, e.g. "primary_contact" and "associated_contact" are defined in ACF as post objects with the relevant filter applied, just as with the "reports" CPT, the related contacts are defined as post objects with the filter "staff" applied. All are configured to return post IDs, so I'm thinking it will work with your approach? | |
Apr 4, 2017 at 5:05 | comment | added | rudtek | oops yep. $report -> ID. I don't know your exact setup with fields etc, but (relationship, post object etc) so you may have to change a bit. See this example: advancedcustomfields.com/resources/querying-relationship-fields | |
Apr 4, 2017 at 5:02 | comment | added | nickpish |
thank you very much for the feedback @rudtek-- would you explain how/why you're using get_the_ID() to match the name of the relevant staff member? And the echo line would be get_the_title( $report->ID); no?
|
|
Apr 4, 2017 at 4:52 | history | answered | rudtek | CC BY-SA 3.0 |