Tyssen Posted March 31, 2016 Share Posted March 31, 2016 I'm using this: $categories = $pages->get(1077)->children->shuffle(); foreach($categories->slice(0, 6) as $category) : include("./inc/category-items.inc"); endforeach; to randomise and display only 6 items of a certain page's children. Now I also need to exclude children which have a certain template from the output. I did have: if($category->template->name!='exclude') include("./inc/category-items.inc"); but that sometimes results in only 5 items being shown. What do I need to do to the $categories array before it gets sliced? Link to comment Share on other sites More sharing options...
teppo Posted March 31, 2016 Share Posted March 31, 2016 $categories = $pages->get(1077)->children("template!=exclude")->shuffle(); 2 Link to comment Share on other sites More sharing options...
tpr Posted March 31, 2016 Share Posted March 31, 2016 Filter pages right on getting them: 1077)->children('template!=exclude')... Edit: shouldn't try being fast when on mobile 2 Link to comment Share on other sites More sharing options...
Tyssen Posted March 31, 2016 Author Share Posted March 31, 2016 Thanks guys Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now