3

I have a client who has an Upcoming Events view. However, when there are no upcoming events, he wants to show another view (Past Three Events) which shows the past 3 events. Basically he doesn't like it when the page doesn't show any events so he wants to show something.

I thought of attaching another block of the Past Three Events to the bottom of the main view (Upcoming Events) and then using jQuery to hide it if the main view (Upcoming Events) is populated.

But I was hoping that someone knows a more elegant solution where perhaps either I can conditionally run a view (perhaps using EFQ which I know nothing about) or somehow adjust views to combine 2 queries in one.

1 Answer 1

8

When editing the view, under Advanced > No results behavior select Global: View area. Select the view you wish to show if the first has no result, and check if you want the replacement view to inherit the contextual filters of the first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.