Forum
Drafts showing when using perch_content_custom
Hi. I've noticed that I see drafts when putting out a shared region on page using the following code:
<?php
perch_content_custom('Events', array(
'template' => 'event_table.html',
));
?>
Is this the expected behaviour? Ideally I'd like to be able to hide any drafts if possible. Doing a "Republish" moves gthe draft entry to the bottom of the results returned from perch_content_custom()
.
I was running Perch v2.4.9, but upgrading to v2.5.4 doesn't appear to have fixed the issue.
When you say you're seeing drafts, what do you mean?
You should be seeing the previous revision before the new draft revision.
I'd assumed that marking something as draft would hide the item entirely, not just the latest revision. I guess I'm incorrect in thinking that?
So if I want to hide things, presumably I'll need to add my own Perch field to toggle the item on/off and then use
perch_content_custom()
to filter by that field?Yes, you're incorrect - the revision is in draft, the item isn't unpublished.
You could add your own field to show/hide items and filter by it, yes.
Are there any plans to add an "unpublish" feature at some point in the future? It seems like it would be a worthwhile feature to have, instead of having to implement it manually for every applicable template.
No plans, no, as it's already possible. You've got a flexible and powerful toolset for implementing this and so many other features that meet the need of whatever type of site you're building.