0

This is somewhat related to this How can I display a "pending" entry in my "_entry" template?

I have an 'events' section where some entries have a future date - the above link solved my issue to get those listed in a sidebar and display single entries while ignoring the date. So far so good.

I have a homepage slider (a matrix field) where each slide can link to an entry - problem is those entries with a future date from the 'events' section are simply not showing up.(block.slideLink is my entries field inside the matrix)

Any ideas how to get around this?

{% for block in entry.homeslider %} {% if block.type == 'slides' %} <div class="item {% if loop.first %}active{% endif %}"> <img src="{{ siteUrl }}assets/img/slide-1.jpg" alt="" /> <div class="k-carousel-caption pos-2-3-right scheme-dark"> <div class="caption-content"> <h3 class="caption-title">{{ block.slideTitle }}</h3> <p>{{ block.slideIntro }}</p> <p> {% for link in block.slideLink %} <a href="{{ link.url }}" class="btn btn-sm btn-danger">lees verder...</a> {% endfor %} </p> </div> </div> </div> {% endif %} {% endfor %} 

1 Answer 1

2

Forgot to take the entry status into account + an additional check for the sectionhandle to cover the custom route. This solved it for me, if you have a better suggestion I'm all ears.

{% for link in block.slideLink.status('live', 'pending') %} {% if link.section.handle == 'events' %} <a href="{{ siteUrl }}events/{{ link.slug }}" class="btn btn-sm btn-danger">lees verder...</a> {% else %} <a href="{{ link.url }}" class="btn btn-sm btn-danger">lees verder...</a> {% endif %} {% endfor %} 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.