Skip Navigation

[Resolved] Conditional display not working (CRED) – Not recognizing variable

This support ticket is created 2 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.

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)

This topic contains 4 replies, has 2 voices.

Last updated by catherineB 2 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2355743
conditional-not-recognizing-taxonomy.jpg

I'm trying to display a taxonomy if a specific choice is selected in another taxonomy.

It works perfectly for some taxonomies, but some others seems not to be recognized.

Working:
[cred_show_group if="($(classe) eq 'Logement' )" mode='fade-slide']
<div class="cred-field cred-field-subvention-logis">
<div class="cred-label">[wpml-string context="cred-logement"]Est-il éligible à la subvention logis?[/wpml-string]</div>
[cred_field field="subvention-logis" post="logement-accessible" value="" urlparam=""]
</div>
[/cred_show_group]

Not working:
[cred_show_group if="($(region-qc) eq 'Montréal' )" mode='fade-slide']
<div class="cred-field cred-field-quartier-montreal">
<div class="cred-label">[wpml-string context="cred-logement"]Sélectionnez votre quartier[/wpml-string]</div>
[cred_field field="quartier-montreal" post="logement-accessible" value="" urlparam=""]
</div>
[/cred_show_group]

I thought it would be a problem with the accent, so I tried with "Laval", but it's still not working
[cred_show_group if="($(region-qc) eq 'Laval' )" mode='fade-slide']
<div class="cred-field cred-field-quartier-laval">
<div class="cred-label">[wpml-string context="cred-logement"]Sélectionnez votre quartier[/wpml-string]</div>
[cred_field field="quartier-laval" post="logement-accessible" value="" urlparam=""]
</div>
[/cred_show_group]

When I'm trying to use the GUI, the field region-qc is not listed.

I've validated the names, and it's well written, see image.
Page : hidden link (just below the map)

#2356065

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Indeed you should use the English text only and other accent are not supported.

Can you please share admin access details as I would like to see why Lavel is not working as I can see that the conditional group works based on term name with my test site.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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.

#2356359

Minesh
Supporter

Languages: English (English )

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

Could you please check now: hidden link

I've adjusted the conditional group [cred_show_group] code to compare the taxonomy term when its displayed as select as given under. As you display the term with select box you will have to compare with the term ID.

 [cred_show_group if="($(region-qc) eq '1479' )" mode='fade-slide']	
      	<div class="cred-field cred-field-quartier-montreal">
			<div class="cred-label">[wpml-string context="cred-logement"]Sélectionnez votre quartier[/wpml-string]</div>
			[cred_field field="quartier-montreal" post="logement-accessible" value="" urlparam=""]

		</div>
     [/cred_show_group]
      
     [cred_show_group if="($(region-qc) eq '1486' )" mode='fade-slide']	
      	<div class="cred-field cred-field-quartier-laval">
			<div class="cred-label">[wpml-string context="cred-logement"]Sélectionnez votre quartier[/wpml-string]</div>
			[cred_field field="quartier-laval" post="logement-accessible" value="" urlparam=""]
		</div>
     [/cred_show_group]

Can you please confirm it works as expected.

#2356399

Ok. So the code is the same, but we change the type of comparison
- Checkbox mode = we use the name of the term ('Laval')
- Dropdown list mode = we use the ID of the term ('1486')

#2356401

I works. Thanks! 🙂