Jump to content

Exclude certain children based on template


Tyssen
 Share

Recommended Posts

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...