Skip Navigation

[Resolved] Conditional display of heading if view is empty or not have any results

This thread is resolved. Here is a description of the problem and solution.

Problem:
Conditional display of heading if view is empty or not have any results

Solution:
What you should do is, try to add a conditional block and configure it to check with view's shortcode and further select "number of items found in view" and setup your conditional display and then move the conditional block between view's output and view's loop section.

You can find proposed solution in this case with the following reply:
https://toolset.com/forums/topic/conditional-display-of-a-view-if-it-is-not-empty/#post-2330179

Relevant Documentation:

This support ticket is created 3 years, 4 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by larsZ 3 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2330117

Dear Toolset Support,
how can I display a view with a related headline in front of it only in case it has at least one content?

Thank you,
Lars

#2330133

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share the screeonshot of your view edit page that should help me to understand how you configured your view and where you are trying to display the heading title?

#2330151
Bildschirmfoto 2022-03-30 um 14.46.09.png

Hi Minesh,
this is the page I set up so far:
hidden link

The contact cards and the header "Kontakte" are placed in a Kadence element.
I tried to put them in a conditional, but don't know, which parameters to set to show the whole element only in case it has some content in the view block.

Another issue is, that some of the toolset css defs are not executed from within the Kadence element: e.g. the grid of the tb-grid class works fine if a place the view in a page, but it breaks apart when a place it inside the Kadence element. (As a workaround I copied the css and assigned it to a custom css class. It's strange, anyway.)

Thanks for your support. Please let me know, if you need further informations.
Best, Lars

#2330179

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What you should do is, try to add a conditional block and configure it to check with view's shotcodes and further select "number of items found in view" and compare it as shown with the following image:
=> https://nimb.ws/h7n3lj

Then move the conditional block between view's output and view's loop section as shown with the following image:
=> https://nimb.ws/V2m0vy

And add whatever block or text you want to display within the conditional block. I hope this will help.

#2330207

That worked perfectly well, thank you!
Do you have any idea for the lost toolset css within Kadence elements? Are there any known issues?

#2330215

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that it works as expected.

You can find all known issues with the following link, there are few related missing styles when using third-party block plugins:
- https://toolset.com/known-issues/

Please kindly open a new ticket with every new question you may have. This will help other users searching on the forum as well as help us to write correct problem resolution summery.

#2330217

My issue is resolved now. Thank you!