Skip Navigation

[Resolved] How to display view conditionally

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

Problem:
How to display view conditionally

Solution:
You can use view's shortcode [wpv-conditional] to display the conditional view's output.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/is-automatically-added-in-my-slider-view/#post-1239868

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 5 years, 6 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by maximilianD 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1239785

I'm trying to show a slider with 4 products in a row.
For some reason, a <div class="clearfix"></div> is automatically added after each slider cell which causes to show the slider cells underneath each other instead of next to each other.

The problem appreas on all product pages.

The view name is: zubehoer-view

#1239805

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - can you please share problem URL and access details and few screenshots of your expected results.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1239807
#1239824

Minesh
Supporter

Languages: English (English )

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

Well - it looks like you are also working on the same view. So I see the conflicts. Please let me know once you done with view editing.

First of all, can you please update ALL Toolset plugins to the latest version.

After checking to debug information you shared with us, I found that you are using outdated Toolset plugins. We always recommend running your site with latest stable release plugin version.

*** Please make a FULL BACKUP of your database and website.***
Could you please update ALL Toolset plugins to it's latest officially released version. You can download the latest plugin release from your accounts page:
=> https://toolset.com/account/downloads/

#1239835

Sorry about that. I stop working on it now. I can't seem to find the error. Hope you can help

#1239862

Minesh
Supporter

Languages: English (English )

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

Please check now. I've adjusted the output within the loop editor of view and add row and col-sm-3 classes.

#1239864

Thank you so much. Looks good now.
But I now saw that something doesn't seem to be right with the query.

Products that don't have any "zubehoer" associated, have all products shown in the slider
/produkte/hygiene-schutz-set-schwarz

#1239868

Minesh
Supporter

Languages: English (English )

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

For that issue - I've changed the way how you display the view inside your divi module as given under:

{!{wpv-conditional if="( '{!{types field='zubehoer' separator=', '}!}{!{/types}!}' ne '' )"}!}

{!{wpv-view name='zubehoer-view' cached='off' sku='{!{types field='zubehoer' separator=', '}!}{!{/types}!}'}!}

{!{/wpv-conditional}!}

{!{wpv-conditional if="( '{!{types field='zubehoer' separator=', '}!}{!{/types}!}' eq '' )"}!}

{!{wpv-view name='zubehoer-view' cached='off' sku='0'}!}

{!{/wpv-conditional}!}

We are checking if field is not empty then pass the field value else pass the 0 value to sku.

#1239870

Thanks again. Very helpful. Hope I don't have to bother you too much during the next few days 😉