Navigation überspringen

[Gelöst] How to display view conditionally

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 5 Jahren, 8 Monaten. 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.

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)

Dieses Thema enthält 7 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von maximilianD vor 5 Jahren, 8 Monaten.

Assistiert von: Minesh.

Author
Artikel
#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

Sprachen: Englisch (English )

Zeitzone: 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

Sprachen: Englisch (English )

Zeitzone: 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

Sprachen: Englisch (English )

Zeitzone: 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

Sprachen: Englisch (English )

Zeitzone: 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 😉