Getting page attributes for page

  • Hi,


    I've added a template for some openGraph page attributes, including an image. Now I'm sort of 'extending' the search function and would like to show the mentioned image in search results if one is available.


    For context, I've added a search template that returns the search results as XML, which I then parse (and group) in search.php. So far all is well.


    So now I'd like to know if I can get the page attributes for a certain URL (other than the current page)? I've tried adding array('page' => $url) to the options of perch_page_attributes, but this didn't seem to work.


    Any thoughts?


    Thanks

  • drewm

    Approved the thread.
  • Hi,


    When you use perch_pages_navigation(), Perch includes the pages' attributes.


    So now I'd like to know if I can get the page attributes for a certain URL (other than the current page)?


    perch_pages-navigation() was not designed to get a single page, so I don't think you can pass a single URL to it and get back its attributes. However, you can use it to get all pages and find the page you're looking for in the returned array in PHP:


    PHP
    1. $pages = perch_pages_navigation(['skip-template' => true]);
  • perch_pages-navigation() was not designed to get a single page, so I don't think you can pass a single URL to it and get back its attributes. However, you can use it to get all pages and find the page you're looking for in the returned array in PHP:


    PHP
    1. $pages = perch_pages_navigation(['skip-template' => true]);

    This works for me, thanks!