Forum

Thread tagged as: Question, Problem, Blog

Displaying a page title from another page

I've got a blog installed. I've created an 'Intro' region on my main blog index and also changed the page title of the blog to 'Articles'.

On the blog post page I want to display the title from the index.... I can access the intro fine with:

<?php
    perch_content_custom('Intro', array(
         'page'=>'/blog/index.php'
    ));
?>

But how do I get the title?

Julian Scott

Julian Scott 0 points

  • 7 years ago

ahhh

<?php
    perch_page_attribute('pageTitle', array(
         'page'=>'/blog/index.php'
    ));
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

You've got it.

Is there any way to use page attributes with perch_content_custom?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Use in what respect?

I mean can I output the page title, description, or any other custom page attributes when using perch_content_custom? I've tried using perch_content_custom call and referencing perch:pages inside my template but that doesn't seem to work.

Maybe I'm confusing myself... Sorry if my questions seem dumb.. Its taking me a while to get my head around how perch works.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Tried passing in the page option and it didn't work, perhaps because the page the code was on did not exist in Perch. Checked out the perch_page_attribute code and it appears that the page _id is what needs to be passed in options if the current page is not in Perch.

So it would be:

<?php
    perch_page_attribute('pageTitle', array(
         '_id' => 33 // whatever the page ID is, viewable in the URL query string when editing the page in Perch
    ));
?>