I’m writing a magazine/article plugin using ACF.
I have two custom post types: magazine and article.
The article contains two custom fields: pagenumber and issue.
The field issue is a relation field relating to the id of the magazine.
I also have a custom taxonomy for the articles such as “feature”, “cooking” and so on.
Now: On a detail page of an issue I’d like to put all the articles below the cover and other details. For selecting them, I’m using my custom field “issue”, for sorting the articles I’d like them to be sorted by the taxonomy and then by pagenumber.
It’s not working since the orderby field seems to not like the field name. I know the example from the documentation, but that doesn’t fit since I need meta_key value for the relationship and can’t declare a different one for sorting.
I also have no clue how to integrate the custom taxonomy into the query. Any advice is appreciated.
Thanks for your reply. I admit to not understanding your hint.
I’ve used meta_query as well but it does not support the sorting in combination with the custom field while having a where-clause with a different custom field. Or at least I didn’t get it to work.
For now I’m building an own array with the data needed and do a multi-sort to get the result I need.
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘Advanced Sorting problem’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users