Forum

Thread tagged as: Question

Pages saved as draft show up in perch_pages_navigation

Hi,

I'm working on some pages in draft mode. The pages are hidden as they're in draft, but they show up in perch_pages_navigation.

Is there something I can add to the code below to exclude/hide pages saved as draft?

 <?php  
 perch_pages_navigation (array(
          'hide-extensions' => true, 
          'from-path'=>'*',
          'from-level'=>1,
          'include-hidden' => false,
          'include-parent' => true, 
          'only-expand-selected' => true,
          'template' => array('stacked-nav/level-1.html', 'stacked-nav/level-2.html', 'stacked-nav/level-3.html')
    ));
    ?>

Summary information

Perch Runway: 3.0.14, PHP: 7.2.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.0.14), assets (3.0.14), categories (3.0.14), perch_forms (1.10)
App runtimes: <?php $apps_list = array( 'perch_forms', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/stephen/Repositories/my-site/perch
PERCH_CORE: /Users/stephen/Repositories/my-site/perch/core
PERCH_RESFILEPATH: /Users/stephen/Repositories/my-site/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/stephen/Repositories/my-site
HTTP_HOST: my-site.test
Stephen Meehan

Stephen Meehan 4 points

  • 3 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

Hi Stephen,

the perch_pages_navigation function will look at the list of pages you have on your site - a "draft" status is set per region. Setting a region to draft isn't going to prevent the page showing.

Also, my understanding of a draft (and this could be wrong...!) is current (or new) content in a region that you don't wish to show on the live site. The region will probably have content in it already - the draft status applies to the updated content. if you think of the revisions behind the scenes, any revision flagged as draft won't show, but the most recent revision not flagged as draft, will show on the live site.

This probably applies to your other question about drafts too.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Duncan is correct, pages don't have drafts.

Hi Duncan / Drew

@Duncan - Thanks for taking the time to write up a great reply.

I forgot regions are independent of pages. I'll just hide any pages (via page settings) that aren't ready to be published.