Jump to content

Recommended Posts

Posted

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

Posted (edited)

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
Posted

That's great, @DaveP. Thank you. The first example didn't work and threw back some PHP errors, but the second definitely works. That's really appreciated!

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
×
×
  • Create New...