Skip Navigation

[Resolved] Conditional display of a View inside a Container

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Anthony 4 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1567325

I would like to display the contents of a Container only if the View that is one of the elements in that Container is not empty. Is there a way to set up a Conditional to accomplish that?

#1567691

Hi Anthony,

Thank you for contacting us and I'd be happy to assist.

To suggest the best way to achieve this, I'll need to see exactly how this container and view is set up in the admin area.

Can you please share temporary admin login details along with the link to a page with this container?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1568937

Hi,

Thank you for sharing further details.

For what you're planning, you can use the following steps:

1. In the "Additional CSS Class(es)" field for the "Accordion Item" block that you'd like to target, you can include a custom CSS class, for example, "featuring-container".
( screenshot: hidden link )

2. The next step would be to include some custom CSS code to hide this accordion-item container, but only when that view returns no results.

For this, you can place that CSS code inside that view's "[wpv-no-items-found]... [/wpv-no-items-found]" tags.
( screenshot: hidden link )


<style type="text/css">

.featuring-container.wp-block-pb-accordion-item {
display: none;
}

</style>

As a result, this CSS code will only be included in the output, when the view will have no results and the enclosed container will be hidden.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1569009

This totally resolves this issue - thank you very much!