ttttim Posted July 15, 2016 Share Posted July 15, 2016 I have an event page were you can select multiple sub-categories with a page field using checkboxes. Now i want to display all the sub-categories but also have them sorted by their parent category. I tried something lik below but that didn't work. $tags = $event_cat->find("sort=$event_cat->parent"); foreach ($tags as $tag){ echo $tag; } Any ideas? Link to comment Share on other sites More sharing options...
arjen Posted July 15, 2016 Share Posted July 15, 2016 Hi Tim, What is the structure of your tree? I've read your question twice, but can't seem to understand what you mean. You can sort by subfields like: $pages->find("template=test, sort=parent.title, sort=page_field.sort"); Perhaps that is what you are looking for? 1 Link to comment Share on other sites More sharing options...
ttttim Posted July 15, 2016 Author Share Posted July 15, 2016 And still you where able to answer my question! sort=parent.title Is what i was looking for. 1 Link to comment Share on other sites More sharing options...
Robin S Posted July 15, 2016 Share Posted July 15, 2016 If your parent categories are siblings you can do this: $page->my_page_field->sort("parent.sort"); (You can do it anyway even if they're not siblings but the sort might not make much sense in that case.) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now