Forum
Using perch_custom_content only for immediate child pages
I have a folder called alumni with a folder inside of it called profiles.
I wish to retrieve content from the /alumni page only and not any pages under /alumni/profiles.
My current code, which grabs all pages:
<?php perch_content_custom('Header', array('page' => '/alumni/*', 'template' => 'article_card.html')); ?>
How can I specify that I only want the pages residing in /alumni and not also /alumni/profiles ?
Something similar to the following would be ideal:
<?php perch_content_custom('Header', array('page' => '/alumni/*/', 'template' => 'article_card.html')); ?>
There's not a way to do that.
Could I request this as a feature?
You can, but I can't make any promises at this stage.
Finally found a solution to this: Instead of using perch_content_custom I switched to perch_pages_navigation:
Content like a background image, description and header are now added through perch_page_attributes, which can be accessed in the navigation template with <perch:pages ... />
For future reference for anyone trying to do the same.