Hi,
I would like to filter content based on type; I saw the Collection::ofType($type)
filter that seems to do what I expect.
But I can’t manage to use it so far to display the 5 latest classified :
{% set latest_classified = page.collection({
'items': '@root.descendants',
'order': {
'by': 'date',
'dir': 'desc'
},
'limit': 5,
'ofType':'classified',
})
%}
On collection page, there is a PHP example but I would like to keep in a Twig universe:
$collection = new Collection();
$collection->setParams(['taxonomies' => ['tag' => ['dog', 'cat']]])->dateRange('01/01/2016', '12/31/2016')->published()->ofType('blog-item')->order('date', 'desc');
Thanks,
Nicolas