I had started putting foreach loops inside of snippets, then calling the snippet.
I already pass through options like limit(), listed(), and others.
Now I’d like to pass through the shuffle() into the snippet.
I’ve searched around the forum, and have even watched some of the instructions on the latest video from YouTube about filtering (awesome!).
Back to snippets, here’s the best explanation I can find, but doesn’t go so far as describing how to do my ask:
Knowing that where it’s placed in the chain is important, how do I add a shuffle option that can be turned on when calling a foreach snippet?
Well, one way would be to pass true/false as values of `shuffle, the use an if statement. Shuffle doesn’t accept a parameter that you could turn on or off.
The alternative would be a custom pages method that conditionally returns the shuffled collection or the unshuffled collection.
This bit is in the wrong position, you cannot sort the page, so it should be after children, and $page('nps') is wrong code. should be without the $ sign. And single quotes around num are also missing.