I'm working on a Craft-based site that has a category defined for "Members". I can see in the admin panel one has the ability to drag the entries for this category in any arbitrary order (when Structure is selected from the Sort dropdown), and I'm trying to figure out how to output that display order via a template to the front-end (in this case, within a navigation area.) The existing markup is as follows:

{% set myCategoryQuery = craft.categories()
    .group('members') %}
{% set categories = myCategoryQuery.all() %}
{% nav category in categories %}
<li><a href="{{ category.url }}" class="dropdown-item">{{ category.title }}</a></li>
{% endnav %}

I thought that by not specifying an order parameter it would default to the display (structure sort) order, but no such luck. I found this thread related to custom order of categories, but I'm not sure if it applies to my case (?) Also, looking in Craft's docs, I don't see an option to set order in this way. Thanks for any assistance here- I'm quite new to this CMS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.