Forum

Thread tagged as: Question, Problem, Error

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.

James Harrison

James Harrison 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

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?

Drew McLellan

Drew McLellan 2638 points
Perch Support

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.

Drew McLellan

Drew McLellan 2638 points
Perch Support

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.