Closed sbstnslg closed 3 years ago
have you tried query: site.index.filterBy('Feature', '*=', 'true').sortBy('date', 'desc')
? (change desc
with asc
if you want oldest first). I assume every page in your website that has a Feature
field also has a date
field?
If it doesn't work, you can always point to a collection, with query: kirby.collection('featured')
.
Then in site/collections/featured.php
put something like this:
<?php
return function($site) {
return $site->index()->filterBy('Feature', '*=', 'true')->sortBy('date', 'desc'); //or whatever you can do in PHP :)
};
Oh that was too easy that I didn't figure it out myself - your first suggestion is the solution :-) Thx in advance!
Im using your plugin to display featured items from 4 different pages with
query: site.index.filterBy('Feature', '*=', 'true')
but this is unsorted :-/Any chance to order the list by date?