Home › Toolset Professional Support › [Resolved] How to chck for related posts and hide Beaver Builder row when there are none.
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 |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
Tagged: Views plugin
This topic contains 1 reply, has 2 voices.
Last updated by Beda 5 years, 6 months ago.
Assisted by: Beda.
Tell us what you are trying to do?
I'm using a views shortcode in a Beaver Builder HTML module to display a ToolSet View - in my case, related testimonials/reviews. What I want is to hide the entire Beaver Builder row that contains the HTML widget with the Views shortcode when there are no related testimonials to display.
Is there any documentation that you are following?
No
Is there a similar example that we can see?
No
What is the link to your site?
hidden link
You would have to ask Beaver Builder's Support "How to hide/show entire Beaver Builder Rows conditionally, depending on any external output".
Since the Toolset Views produces an output that can be rendered either as ShortCode or as Function you can simply return 1 or 0 in a custom Function whenever the View is showing or not showing results, but you still would face the question how to make Beaver Builder respect that.
The question should hence be directed to the Beaver Builder Support, as the experts there will eventually be able to provide a solution for this.
From Toolset's point of View, you can use HTML conditional inside any content that accepts ShortCodes.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
So you can hide or show as well entire Views, depending on certain outputs, but you cannot control other's Plugins elements with this unless you can wrap those elements in an HTML Conditional ShortCode.
And as far I know - this is one of the major problems of all page builders, inclusive Gutenberg - they do not let you edit the HTML of those rows, columns, and so on.
If you could, you could simply wrap the HTML in our conditionals, like you would do it in a Content Template when adding Rows with manual HTML.
In builders, those rows are "blocks" and cannot be wrapped by ShortCodes in this sense.
Something that might work (but you would have to test) is, for example, arranging your layout when editing with the Builder like this:
- here insert text widget with opening HTML Conditional ShortCode ([wpv-conditional])
- here insert row block with all its content
- here insert another text widget with the closing HTML Conditional ShortCode.
This could help hiding the Row Block or showing it according to the HTML conditional, however, I am not sure this will work, it depends on what is executed when in the Builder.
It is surely not "intended" to be used like this, as the Builders Blocks are independent items, and hiding/showing them, unfortunately, is something that needs to be done by those Plugins.
As a workaround, you can always use Content Templates with manual HTML and HTML conditionals.
You could pre-generate HTML with editors like Pinegrow and paste that to the Content Template for faster development, but you could not use the Builder in this case, of course, because those do not produce raw HTML you can edit.