Find all pages using template a OR template b

Hello,

I can’t seem to find a snippet that shows how to do this. I want to find all pages using either template a OR b. This is what I am using at the moment but I need to add more templates?

$pages = $site->index()->visible()->filterBy('template', 'a');

Thanks

You probably missed the Filtering Compendium :wink:

$pages = $site->index()->visible()->filter(function($child) {
  return $child->template() == 'a' || $child->template() == 'b';
});
1 Like

Damn! I did miss that one! Thanks