Forum
Expiring Content
I have created some custom content on a site which acts as a listing of events. I wondered if there was a means of expiring content in Perch, such that after the date of the event they were no longer displayed?
I have created some custom content on a site which acts as a listing of events. I wondered if there was a means of expiring content in Perch, such that after the date of the event they were no longer displayed?
Add a date to your template, and then filter on that using
perch_content_custom
.https://docs.grabaperch.com/functions/content/perch-content-custom/
Thanks Rachel, I'm much more of a designer than developer so programming something like this is well out of my knowledge. I understand to filter on the start date of my content, and to use match as a means of saying only show it if… but it's saying today date is what to check against I don't understand.
This is my thinking:
That produces this in debug and so I'm not really sure where to go.
getdate()
returns an array, which is causing the error.Try
date()
instead.Thanks Duncan, that is no longer causing an error however, it is still displaying an item with an older start date than today.
Using this it still returns this items with older dates on.
I've done a few things with perch calendar, but not had to attempt this, and i'm not sure perch calendar can do it. so I think I'd tackle this using javascript and css...
Can't take credit for the code, but I think its what you could be looking for.
I'm not sure javascript is needed for this.
Try
date('Y-m-d')
The date needs to be ISO format, so try
date('Y-m-d H:i:s')