[Résolu] Color or Background change using Conditionals in Views
This support ticket is created Il y a 4 années et 3 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.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
That happens because the conditions for the yellow section ($(wpcf-item-start-date) ne 'TODAY()') and the blue section ($(wpcf-items-statuses) ne 'Complete' ) AND ( $(wpcf-item-end-date) gte 'TODAY()') are both true, and so both get output.
You need to make sure that your conditions are mutually exclusive to avoid outputting more than one block of markup at a time.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
I'm still not sure quite what you mean.
The View iterates over posts, which you are outputting as rows in a table.
For any given row, the tds should be output only once.
You have several conditional tests, each outputting a complete set of tds for that post iteration, i.e. that row.
Which is why you need to carefully choose conditions that are mutually exclusive, so that the set of tds can only ever be output once for that row. Your yellow-and-blue screenshot shows two groups of tds being output for the same row, but there should only ever be one.
So it seems like you need to rethink the logic of your conditional tests (rather than the syntax of implementing the tests).
Otherwise, what do you expect to happen when both the yellow and blue conditions are true for the same post being iterated over?
That they should both be output, but on separate rows?
If that's the case then you would need to move the tr tags inside the linked template, within each conditional section.
Right now they are in the wpv-loop section but not in the linked template, i.e.
Sorry for the late reply back Nigel, You meant moving the TR tags into the loop as part of each condition statement? Yes, that appears to have fixed it. Sorry for not making sense.