Forum
Perch CMS - Get first item out of region list
I'm using the Perch CMS to pull through some captions for a bxslider. I currently have 4 taglines. Because I'm using a different image on each bxslider list item I'm wondering if there's a way to pull out a specific index of the array itself.
<ul class="bxslider"> <li> <img src="assets/img/banners/hay-banner.jpg"/> </li> <li> <img src="assets/img/banners/final-farmhouse-banner.jpg"/> </li>
<li> <img src="assets/img/banners/final-tractor-banner.jpg"/> </li> <li> <img src="assets/img/banners/property-owners.jpg"/> </li> </ul>
That's my HTML code currently. And I want to be able to pull the taglines out using
<?php perch_content('Taglines');?>
But obvioulsy that will pull all of the taglines into the title and not just the first tagline for the first <li>, the second tagline for the second <li> tag.
Is there a way to do this within perch? (Ideal output below).
<li> <img src="assets/img/banners/hay-banner.jpg" title="perch_content('Taglines (1))"
You can use
perch_content_custom()
to do that. Use thecount
option to set how many items you want to return.https://docs.grabaperch.com/functions/content/perch-content-custom/
Thanks for the information. https://www.psiphon.onl