Skip Navigation

[Gelöst] Strange behaviour on complex view

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

Problem:
The user is using a content template inside of an archive loop. The content template has some conditions to not be shown on the archive pages.

Solution:
For some reason, the conditions are not working. So, we can hide the content template with custom CSS code.
Check this reply https://toolset.com/forums/topic/strange-behaviour-on-complex-view/#post-1766743

This support ticket is created vor 3 Jahre, 7 Monate. 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9: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: Africa/Casablanca (GMT+00:00)

This topic contains 7 Antworten, has 2 Stimmen.

Last updated by romanB-3 vor 3 Jahre, 7 Monate.

Assisted by: Jamal.

Author
Artikel
#1765103

Hi,

I have a complex Archive view, calling nested views and content template.

The main view is hidden link and is used for every "Formations" taxonomies.

When loading a term page (for instance hidden link), I have the expected results (1. a map of Institutes, then 2. a list of Formations).

I then can edit the dynamic filters and I still get the expected results : for instance I can add the Domaine "Agriculture" and it displays 1. the map of Institutes with children Agriculture Formations, then 2. the list of all Agriculture Formations themselves.
But if I delete that "Agriculture" filter, it now displays 1. the expected map of institutes, then 2. the institutes descriptions, and last 3. the formations themselves.

I don't need the Institutes descriptions to display there.

It may be a problem with this content template hidden link, where I set this condition before the institutes descriptions :

[wpv-conditional if="( is_post_type_archive('formation', null) eq '0' ) AND ( is_tax('niveau', null) eq '0' ) AND ( is_tax('domaine', null) eq '0' ) AND ( is_tax('ville', null) eq '0' ) AND ( is_tax('type-de-formation', null) eq '0' )"]

Meaning this description should only appear if the current page is NOT a formation post type archive.

Problem is precisely that the page hidden link IS a formation post type archive, so this content should never display, not on loading the page, nor when editing the filters.

Thank you.

#1765441

Jamal
Supporter

Languages: Englisch (English ) Französisch (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

I can see the issue, once we remove the filter on domains, the view displays the list of establishments. I'll need to access the backend as an administrator to be able to debug this issue further. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1766099

Jamal
Supporter

Languages: Englisch (English ) Französisch (Français )

Timezone: Africa/Casablanca (GMT+00:00)

As you said, it seems that the following condition does not work correctly on this case:

[wpv-conditional if="( is_post_type_archive('formation', null) eq '0' ) AND ( is_tax('niveau', null) eq '0' ) AND ( is_tax('domaine', null) eq '0' ) AND ( is_tax('ville', null) eq '0' ) AND ( is_tax('type-de-formation', null) eq '0' )"]

Maybe because it was an AJAX call, but why did it not evaluate the same for the first AJAX call(choosing Agriculture in Domains).

As a workaround, I added a class to the content template, and custom code to hide it for archive pages. Check it here hidden link

body.archive .ts-no-tax {
    display: none;
}

But, I wonder, why are you using the "Infos sur cet établissement" view, which is using this content template, inside of an archive template?

#1766169

Thank you ; this work indeed, but that avoid the list of Institutes to display on Institutes taxonomy pages, as for instance hidden link (where the list should display because we are on a term related to Institutes)
Thank you.

#1766743

Jamal
Supporter

Languages: Englisch (English ) Französisch (Français )

Timezone: Africa/Casablanca (GMT+00:00)

WordPress adds some CSS classes to the body of each page. Taxonomy archives get some classes such as "archive" and "tax-{taxonomy-slug}". In the first CSS that I shared, I used the class "archive". But, as you want the content template to be visible for the taxonomy "Localités", we'll need to use "tax-{taxonomy-slug}" classes instead. The custom code will then be:

/* Taxonomy Villes */
body.tax-ville .ts-no-tax {
    display: none;
}

/* Taxonomy Domaines */
body.tax-domaine .ts-no-tax {
    display: none;
}

/* Taxonomy Niveaux */
body.tax-niveau .ts-no-tax {
    display: none;
}

/* Taxonomy Types de Formations */
body.tax-type-de-formation .ts-no-tax {
    display: none;
}

Or in one CSS rule:

body.tax-ville .ts-no-tax, 
body.tax-domaine .ts-no-tax, 
body.tax-niveau .ts-no-tax, 
body.tax-type-de-formation .ts-no-tax {
    display: none;
}

I used the last code in the content template and it is working. The archive for the taxonomy "Localités" displays the content template hidden link

#1767189

Thank you. This works now for Localités taxonomy too. But if still doesn't for the main "Etablissements" archive hidden link
Thank you.

#1769087

Jamal
Supporter

Languages: Englisch (English ) Französisch (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Can you elaborate more on what's not working for the Etablissements archive?

#1771839

Not sure why or how but My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.