I have the following bit of code on a singular content template
[wpv-conditional if="( $(wpcf-3d-model) ne '' ) OR ( $(wpcf-full_2d) ne '' )"]<h3>Downloadble Information</h3>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-3d-model) ne '' )"]<i class="fas fa-cube"> 3D Model File: [types field='3d-model' title='Click Here To Download'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-full_2d) ne '' )"]<i class="far fa-file-alt"> 2D Drawing File: [types field='full_2d' title='Click Here To Download'][/types][/wpv-conditional]
[wpv-view name="tech-data"]
I have 4 things here
1. a header
2. a link to a 3d model
3. a link to a 2d drawing
4. a toolset view which displays a loop of a repeating field group consisting of a text field (name) and a file, which is dispalyed as a link.
I only want to display the header if one of these conditions is true: there is a 3d model, OR there is a 2d model, OR there is an item in the tech-data loop.
how would i go about constructing a condition for that?
If you need to see the admin, CLICK HERE TO LOG IN AUTOMATICALLY: hidden link
Hello. Thank you for contacting the Toolset support.
Can you please share little more information, when you say "header", when is the header part you referring to. Can you please share screenshot of the header that you want to display conditionally.
a screenshot is attached. the header is just the h3 tag you see in the code. it reads <h3>downloadable information</h3>
if there is no data in any of the custom fields circled in red i want to hide everything circled in red. the problem is that one is a repeating field group and there doesnt appear to be a way to make a conditional for that.
We can either use JS code or use the Toolset post-relationship API function to get the total number of count of repeating field. In your case we will try to get the total number of count of your repeating field group Tech data aka "tech-data-air-filter".
To count the number of repeating field group entries. You will require custom shortcode that will return the number of count.
Before using a custom shortcode [get_rfg_count] inside a conditional, you need to register it. To do so, visit the Toolset -> Settings page and click the Front-end Content tab. There, simply add your shortcode to the Third-party shortcode arguments section.
- I already registered it for you.
Now, you just simply require to modify your conditional statement as given under:
[wpv-conditional if="( $(wpcf-3d-model) ne '' ) OR ( $(wpcf-full_2d) ne '' ) OR ( '[get_rfg_count]' gt '0' )"]
<h3>Downloadble Information</h3>
[/wpv-conditional]
I didn't see the function registered like you mentioned so i added it to functions.php
I added the shortcode into the conditional like you mentioned here: hidden link
i've also just added the short code by itself to see if it's counting. as you can see, it doesn't seem to be counting or doing anything, since the shortcode itself is visible on the front end.