Jump to content

Find pages and filter by multiple pages


a-ok
 Share

Recommended Posts

Hi folks,

I am trying to query (find) pages who have a certain page as a parent, but then filter this result so it only returns the pages listed. I know you can do the following for one:

$pages->find('parent=/widgets/')->filter(1020);

But how do you do it for many? I thought the below would've worked...

$pages->find('parent=/widgets/')->filter(1020|1069|1070|1071|1072|1073|1074|1075|1076)->getRandom();

Thanks,

R

Link to comment
Share on other sites

Try

$pages->find('parent=/widgets/')->filter('id=1020|1069|1070|1071|1072|1073|1074|1075|1076')->getRandom();

Might work.

<edit>Removed non-working guess to avoid confusion in future.</edit>

Edited by DaveP
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...