Please note that I AM NOT USING ToolSet BLOCKS ....
I repeat .. I AM NOT USING ToolSet BLOCKS.
I am using Views in LEGACY MODE in conjunction with Beaver Builder Themer templates.
My question:
I know that it is possible to use conditional statements to check for output from a TYPES custom field.
e.g.
[wpv-conditional if="( $(wpcf-message-to-students) ne '' )"]
<h3>⬛ Message to Students</h3>
<p>[types field='message-to-students'][/types]</p>
[/wpv-conditional]
BUT... what if I want to test whether the output from a View is empty, specifically the output from a View which produces the content of a repeatable field.
e.g.
<h3>⬛ Education</h3>
<p>[wpv-view name="faculty-education-repeating-field"]</p>
In our template, the above code will output the something like the following if repeatable field entries exist.
Education
2020 PhD Harvard
2016 MA Oxford
2012 BA Stanford
BUT ... if there is nothing in those repeatable fields, it will output like this:
Education
No items found
So this is undesirable.
HOW CAN I TEST WHETHER THE VIEW CONTAINS CONTENT VIA A CONDITIONAL STATEMENT OR SOME OTHER TECHNIQUE?
Hi,
Thank you for contacting us and I'd be happy to assist.
Here is a simple approach to show the view's output and the heading, only when it has some results.
1. You can wrap your view's output and the heading, inside a div container with a class name 'education-view-container':
<div class="education-view-container">
<h3>Education</h3>
[wpv-view name="faculty-education-repeating-field"]
</div>
2. Next, in place of the 'no items found' message (i.e. inside the [wpv-no-items-found]... [/wpv-no-items-found] tags), you can include the following CSS code, that hides this view's div container, whenever no results are returned:
<style> .education-view-container {display:none !important} </style>
I hope this helps and please let me know if you need any further assistance with this.
regards,
Waqar
That's brilliant!
Solved the problem perfectly.
Ticket closed.