4

Can anyone confirm if I want to pull back a list of all entries regardless of locale I could do something like craft.entries.locale(null) to get 100% of entries?

1 Answer 1

5

In my experience this has been problematic - instead have looped through locales to fetch entries then merged and sorted with supersort.

Eg:

{% set locales = craft.i18n.getSiteLocales %}   

{% set pages = [] %}    

{% for locale in locales %}
    {% set entries = craft.entries.locale(locale.id).localeEnabled(false).find() %} 
    {% set pages = pages|merge(entries) %}
{% endfor %}    

{% set pages = pages|supersort('rsortAs', "{ postDate|date('Ymd') }") %}

Then loop through pages as you would your entries. Am sure there is a more elegant way of doing this but this is what we had to do for our site.

2
  • Oh god this sounds down right dirty. I do hope there is a better way, but thank you for your answer. I will investigate when I get into this project, thanks!
    – joep
    Commented May 17, 2016 at 14:35
  • Here is the supersort twig filter I presume Cole is referring to: topshelfcraft.com/lagniappe/supersort
    – joep
    Commented May 18, 2016 at 16:30

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.