Forum

Thread tagged as: Question, Problem

Page attributes not showing

Hi

The following code is included in a perch layout file global.header

<body class="<?php
      perch_page_attribute('bodyclass', array(
        'template' => 'body_attributes.html'
      ));
    ?> layout_changer">

The body_attributes.html file looks like this

<perch:pages id="bodyclass" label="Body Class" help="DO NOT CHANGE" type="select" options="home,service,contact" divider-before="CSS class" />

The /pages/attributes/default.html looks like this:

<perch:template path="pages/attributes/seo.html" />
<perch:template path="pages/attributes/body_attributes.html" />

However, the body attributes section is not appear under Page Details, see this screenshot https://www.evernote.com/l/Ai-isRB5DBVM3oqlcgHEXq4tGbgCitwfgjk

Not sure what I'm doing wrong, any clues?

Neil Duddridge

Neil Duddridge 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you want the fields from body_attributes.html to be included in the edit form, they need to be in the master template.

Add a perch:template tag to default.html to include your body_attributes.html template.

Thanks Drew,

I've just realised the error of my ways. The actual attributes file name I created was page_attributes.html doh!

I've now renamed to body_attributes.html and all worked.