Home › Forums › Front-end Issues › WP_query for each loop › Reply To: WP_query for each loop
The reason that I think your having difficulty doing what your trying to do is that you’re trying to group the posts after you get the posts.
get posts => look at field and => group the posts by the field
Once you’ve gotten the posts and started looping through them it is too late to group them in a specific order. You need to set the order/grouping before you get them.
To compound things further, your not only want them ordered by this field, but you also want them ordered in the same order as the field choices set in the ACF field. Depending on what this field holds it may not even be possible to order them.
So, a couple of questions.
Are the choices set in the field choices in alphanumeric order?
Can the wheel_section field have more than one value?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.