Forum

Thread tagged as: Question

Getting page address from content_custom call

If I'm pulling in content on a custom_content call, using 'page' => '/*' with filters that will pull out one page, how can I get the page address to link to?

I'm pulling out details for a recent page that fits certain criteria, but need to provide a link to that page where those details are provided. So the exact call is like:

<?php
perch_content_custom('Event Description', array(
                            'page' => '/*',
                            'template' => '_closer_look.html',
                            'filter' => 'startdate',
                            'match' => 'gte',
                            'value' => '2014-10-10',
                            'count' => '1',
                            'sort' => 'startdate',
                            'order' => 'asc'
                            ));
?>
Mallen Baker

Mallen Baker 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

When doing this, you sometimes need to know where the content has come from. For example, you might have a list of items that has been pulled from multiple pages, and want to link to each item’s page. To help with this the special ID value _page is available within your template:

<a href="<perch:content id="_page" />">Read more</a>

https://docs.grabaperch.com/docs/content/perch-content-custom/