Skip Navigation

[Résolu] Problems with conditionality in Visual Composer when used in templates.

This support ticket is created Il y a 6 années et 4 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Marqué : 

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Beda Il y a 6 années et 4 mois.

Auteur
Publications
#1072589
Schermafbeelding 2018-08-03 om 15.51.37.png

Hi Christian,
You helped me this week with a problem with conditionalities i had using the VC. See this thread: https://toolset.com/forums/topic/conditionality-in-the-visual-composer-is-not-working/
The problem is solved, however, when i try to implement the solution in a template and for a checkbox i'm experiencing problems again. See screenshot for my input. However, i never get to see the form (i tried both bracket types). I guess you still have access to the site.
What did i do wrong?

#1073365

This could be an issue mixed of several things:

- Apostrophes are wrong when inserted to Page Builders in conditionals:
https://toolset.com/errata/conditional-shortcodes-are-being-malformed-when-inserted-in-page-builders-with-the-new-shortcode-format/
- There as well seem to be issues with global elements of page builders that use conditionals and/or nested ShortCodes like you do.

Nested ShortCodes are not allowed by WordPress.
We (Toolset) make that possible to use in some cases, and we offer a setting in Toolset > Settings > Front-end Content > Third-party shortcode arguments where you can register any ShortCode you may use in nested or conditional statements.

However, this does not always solve the issue, as said, there is one which we solved with the erratum linked above and another, which we are investigating, where it seems that in global elements conditionals will not work, because those global elements render all ShortCodes at once, which destroys the conditional logic.

if above solutions don't help, this may be due to the Checkbox you are checking upon.
Does this exact same logic work for you if you use another field?

If that is the case, it may be that the checkbox(es) save 0 in case of not checked?
There may be a related issue to that as well:
https://toolset.com/errata/checkboxes-that-save-0-are-interpreted-as-checked-by-views/

We suggest to not save 0 to the database in those cases.

However, could you let me know how things look after you apply above erratum and try to compare other field types, and as well, not mix square with curly brackets in the same ShortCodes?
Remember that our ShortCodes only support this syntax and they are intended in page builders - not on other places and vic versa.