Skip Navigation

[Resolved] Views with conditional output

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.

This topic contains 1 reply, has 2 voices.

Last updated by Christopher Amirian 1 year ago.

Assisted by: Christopher Amirian.

Author
Posts
#2664211
ss 1.PNG
s2.PNG
s3.PNG
s4.PNG

Hello,

I need help with some conditional outputs I'm using. I have an Industries page: hidden link

And I created a view per industry because there are some products that I need to show if the industry is selected.

For example, here: hidden link I checked "Automatizacion" for each product, and they show correctly on the page.

But if I check the product with 'Automatizacion' and 'Computadoras,' I can't see the product on the "Computadoras" page: hidden link

In this case, the product CC600 has been checked with "Automatizacion" and "Computadoras."

This is my code:
<wpv-loop>
[wpv-conditional if="( $(wpcf-type-of-industry) eq 'Computadoras' )"]
<div class="nl_unit">
<img src="[types field='unit-img' output='raw'][/types]">
<h4>[wpv-post-title]</h4>
Ver Producto
</div>
[/wpv-conditional]
</wpv-loop>

I want to know if there's a way to do a multiple selection of industries in each product and show all of them on their respective Industry page.

I'll leave some screenshots, and please let me know if my issue is understandable. Thank you!

#2664439

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

First, you need to know why the second code does not work but the first code works.

Try to use the code you already know it works in the screenshot and just replace the value and see if it works for the second one.

Also try with a product that only has "Computadoras" selected and see if it works.

Usually, the best way to create the view content is to use the filter queries:

https://toolset.com/course-lesson/filtering-custom-lists-of-posts/

But if you want to use conditionals, you can consider using OR / AND operators to combine the conditions.

For more information:

https://toolset.com/forums/topic/conditional-view-with-or/

Thanks.