i am new to craft. Is there a connection between the control panel sorting setting for structure entries and the template output.

{% set entries = craft.entries.section('projects') %}

Changing sort method in control panel should leads to different outputs in template. Is that right?

Goal is to output entries in sort order related to control panel sort settings.

What did i do wrong?

1 Answer 1


No – whatever you've currently set as the sorting order (Structure, Post Date, Expiry Date, etc) in the element index in the control panel has absolutely no effect on how your entries are output in a template, or how they're ordered.

For Structure sections, the default sorting order in a template is Structure, i.e. hierarchical:

{% for entry in craft.entries.section('myStructureSection') %}
    {# Will output entries in hierarchical, chronological order #}
{% endfor %}

Keep in mind that if your Structure has multiple levels, i.e. child entries, you'll have to jump through a few hoops – using the {% nav %} tag is recommended as its able to output child entries recursively, e.g:

{% nav entry in entries %}
        <a href="{{ entry.url }}">{{ entry.title }}</a>
        {% ifchildren %}
                {% children %}
        {% endifchildren %}
{% endnav %}

Finally, if you want to output the entries in a non-hierarchical order, you can use the order parameter:

{% for entry in craft.entries.section('myStructureSection').order('postDate desc') %}
    {# Will output newest first #}
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.