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
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.
-
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!– joepCommented May 17, 2016 at 14:35
-
Here is the supersort twig filter I presume Cole is referring to: topshelfcraft.com/lagniappe/supersort– joepCommented May 18, 2016 at 16:30