Is it not possible to show draft pages in the front end? I tried this:
<?php foreach ($page = $page->children()->draft() as $page): ?>
<?= $page->title() ?><br/>
<?php endforeach ?>
Is it not possible to show draft pages in the front end? I tried this:
<?php foreach ($page = $page->children()->draft() as $page): ?>
<?= $page->title() ?><br/>
<?php endforeach ?>
Should be
foreach ($page->drafts() as $draft) {
// do stuff
}
This should return all draft children only. If you want both children and drafts, then use childrenAndDrafts()
instead.
ok makes sense, cheers!
yes, this ok for my use
But the information is not correct. If you explicitly show the drafts, then everyone can see them.
My whole site is for logged in users only.