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?

joep
  • 610
  • 4
  • 12

1 Answers1

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.

Cole Henley
  • 1,741
  • 11
  • 20
  • 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 May 17 '16 at 14:35
  • Here is the supersort twig filter I presume Cole is referring to: https://topshelfcraft.com/lagniappe/supersort – joep May 18 '16 at 16:30