Forum
Displaying first Image from repeaters on parent page.
I have a repeater on subpages. Each repeater has an image.
Is it possible to output the first image from each subpage to its parent page?
I have a repeater on subpages. Each repeater has an image.
Is it possible to output the first image from each subpage to its parent page?
You can wrap the repeater's contents in:
Thanks Drew. How do I then output it from the parent?
Here's what I have:
Parent template:
/templates/navigation/groups.html
Subpages template:
Do you have your repeater showing on the page where you want it?
Yes the repeater is for a gallery of images on each subpage and that works.
What I'm trying to do is show the first image on the parent page using perch_pages_navigation
Is it showing on the parent page?
I'm unclear whether your issue is displaying the repeater, or displaying just the first item.
Just the first item.
Each subpage has a repeater (header and image).
I want the parent to display a list made up from each subpage's first repeater item.
I know I can add images for nav with attributes, but I was trying to remove that step for editors, so that it just picks up the first image added to the list on each new subpage.
Have you created a template to show just the first item as per my initial reply?
Yes I can see that I'm going about it the wrong way though. Tried this:
templates/content/gallery:
Then templates/navigation/galleries:
Then:
Is the content in page attributes or in a content region?
A content region.
You can't access content regions using navigation functions. You'll need to use
perch_content_custom()
to display the region.Can
perch_content_custom()
still get the first item from each new subpage that is created in the same way asperch_pages_navigation
?Yes, you can use the wildcard syntax for the
page
option - it's in the documentation.Ok thanks for all your help, I'll check it out.