Forum

Thread tagged as: Question, Problem

Get top level parent title rather than direct parent

Is it possible to get the title of a top level parent rather than a page's direct parent? Eg...

/courses/16-18/art-and-design

...would it be possible to get the page title from Courses rather than 16-18? At the minute I'm using perch_pages_parent_page for Art and Design but pageTitle returns 16-18.

Many thanks

Alan Longstaff

Alan Longstaff 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does this output?

perch_pages_navigation(array(
    'from-path' => '*',
    'from-level' => 1,
    'levels' => 1,
));

(Apologies for the late reply - busy weekend!) The structure of the site is:

Courses
  - 16-18 Courses
    -- Art and Design
  - Higher Education

When using the above on the art and design page this gets returned:

  • 16-18 Courses
  • Higher Education

Still doesn't seem to include the root parent unfortunately

Ah I've figured it out, I can just use perch_pages_breadcrumbs and get pageTitle from the first item in the array. Guess the weekend off helped in the end, haha

Thanks Drew

Drew McLellan

Drew McLellan 2638 points
Perch Support

OK, great.