Yes, that should work as well.
Or just:
$projects = page('projekte')->children()->filterBy('hasImages', true)->limit(6);
Ah! Love this!
It’d be brilliant to have this example in the filterBy docs!
I should probably reread my own tutorials or do more brain exercises…
Or force yourself to a strict curfew
Maybe I just love the filter with callback so much …
That’s another point I can’t solve so far…
This is my site structure:
1-projekte
1-corporate-design
2-editorital-design
3-testprojekt
projekt
1-cd1
2-cd2
3-ed1
4-cd3
...
2- ...
I tried 'projekt'
instead of 'projekte'
. But then only the first image in 3-testprojekt
is displayed.
I’ve played arround with ->invisible(). But then no projects are displayed.
So ->children->children() is the only thing that works.
Instead of ->children()->children()
you can use grandChildren()
.
Okay. Thanks for this hint.
Is there a “right or wrong” with ->children()->children() and grandChildren()?
And why I can’t write ‘projekt’ instead of ‘projekte’?
The page()
helper needs the full path to the page, so
page('projekte/projekt')->children();
would also work.
It’s no problem to use ->children()->children()
, but grandChildren()
is shorter …