Working with Craft 2, I have a channel for events that each entry has an expiration date. Live entries should show the upcoming event info and expired entries should show archive info.

I have created a costume route to enable viewing of the expired entries:

news/{slug} →  news/_entry

when I am adding this to the code:

{% set entry = craft.entries.section('news').slug(slug).status('live, expired').first() %}

I can see the expired entries info but than if I am viewing a live entry, the data that I am viewing is not from the entry I am visiting but from the first entry in the section. If I drop this line from my code, than I cannot see the info from the expired entries.

Is there a way to be able to view both?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.