Tell us what you are trying to do?
I have two post types that are used to associate one or more concert posters (i.e. "collectible") with one or more concerts (i.e. "event") via an intermedia post type ("event-collectibles").
The "event" post type has a custom field for "Event Date" ("wpcf-event-date") that stores a unix timestamp.
I would like to query the "collectible" post type to get all collectibles (posts_per_page = -1) sorted by most recent to least recent event date.
Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#new-approach
https://toolset.com/forums/topic/view-orderby-custom-field-not-working/
Is there a similar example that we can see?
I only have examples using the old method using a custom query to join the _wpcf_belongs type fields.
I do not have an example using the new relationships tables.
What is the link to your site?
hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
The filtering and ordering in query work with the custom fields that are directly attached to a post type. This means that if the custom field "Event Date" is attached to the post type "Events", then to order the results by this field, you'll need to set the view to show the "Events" post type and not the "Collectible" post type.
In the view's individual result or loop item, you can then show the related "Events" post(s), using a nested view with a post-relationship filter.
( guide on nested views: https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/ )
Note: The nesting of blocks-based views is not supported, so you'll have to create the child/nested view, using the classic/legacy views editor.
I hope this helps and please let me know if you need further assistance.
regards,
Waqar