All pages that filterBy template

I tried to get all pages that have spesific template like following codes but it didnt work!

$pages->filterBy('template', 'properties');

$site->index()->filterBy('template', 'properties');

$site->pages()->filterBy('template', 'properties');

How can i get all template pages?
Thanks

$pages->filter(function($child) {
    return ($child->template() == 'properties') ? true : false;
});
1 Like

@walkerbox didnt work :frowning:

This should do the trick. Be sure to have a file called site/templates/properties.php

As result you should get a collection of pages you can work with …

3 Likes

@flokosiol OMG! I missed that! Thanks appreciate your help…