[Resuelto] Conditional Output in Visual Editor Cell
Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
Conditional Output in Visual Editor Cell - check multiple fields with and as well as or clause using the conditional statement with custom shortcode
This support ticket is created hace 5 años, 8 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I have a CPT 'User Will' wth fields 'about-yourself-status', 'financial-assets-status', 'residuary-estate-status', 'executors-status' and 'guardians-status'
I also have a custom shortcode [child_func] which if ==1 tells me that the user has children.
What I want to achieve is to display the text 'VIEW NOW' but only if the fields above ( 'about-yourself-status', 'financial-assets-status', 'residuary-estate-status', 'executors-status' and 'guardians-status') all equal 'Yes' however I only want 'guardians-status' to equal 'Yes' if the shortcode [child_func] ==1
This happens on the template page for the CPT 'User Will' so al the fields are present on the page...
I can manage the conditional part for the first 5 fields but not for the 'guardians-status'
[wpv-conditional if="( $(wpcf-about-yourself-status) eq 'Yes' ) AND ( $(wpcf-financial-assets-status) eq 'Yes' ) AND ( $(wpcf-residuary-estate-status) eq 'Yes' ) AND ( $(wpcf-executors-status) eq 'Yes' )"] VIEW NOW [/wpv-conditional]
Hello. Thank you for contacting the Toolset support.
Well - as I understand you want two conditions?
First case:
( 'about-yourself-status', 'financial-assets-status', 'residuary-estate-status', 'executors-status' and 'guardians-status') all equal 'Yes'
Second case:
guardians-status equal 'Yes' and shortcode [child_func] ==1
If yes, what how you want to connect the first case with the second case
- First case AND Second case
- First case OR Second case
Thank you for your speedy response... and yes you're correct with the two cases...and they both need to happen at the same time i.e. First case AND Second case
I only want to include AND ( $(wpcf-guardians-status eq 'Yes' ) in the argument if [child_func] eq '1' )"] so as I've tried to demonstrate below..but I don't think this will work
[wpv-conditional if="( $(wpcf-about-yourself-status) eq 'Yes' ) AND ( $(wpcf-financial-assets-status) eq 'Yes' ) AND ( $(wpcf-residuary-estate-status) eq 'Yes' ) AND ( $(wpcf-executors-status) eq 'Yes' )
AND IF( [child_func] eq '1' )"] AND ( $(wpcf-guardians-status eq 'Yes' )
So to simplify:
IF
'about-yourself-status'
'financial-assets-status'
'residuary-estate-status'
'executors-status'
ALL = 'Yes'
AND ONLY IF [child_func] = 1
AND
'guardians-status'
= 'Yes'
Could you please share problem URL and access details?
*** 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.
This only works if the person has the guardians section active and complete (5) however if the user doesn't have children then this section doesn't show for them and [child_func] = 0
So I need it to be something like:
IF
[wpv-conditional if="(( $(wpcf-about-yourself-status) eq 'Yes' ) AND ( $(wpcf-financial-assets-status) eq 'Yes' ) AND ( $(wpcf-residuary-estate-status) eq 'Yes' ) AND ( $(wpcf-executors-status) eq 'Yes' )) AND [child_func] not equal 1
OR
[wpv-conditional if="(( $(wpcf-about-yourself-status) eq 'Yes' ) AND ( $(wpcf-financial-assets-status) eq 'Yes' ) AND ( $(wpcf-residuary-estate-status) eq 'Yes' ) AND ( $(wpcf-executors-status) eq 'Yes' )) AND [child_func] equal to 1 AND ( $(wpcf-guardians-status) eq 'Yes' )
I have a couple of other small issues that you may be able to help with quickly:
1. When I use a date field with a pop up date select calendar, it takes a few seconds to show the date when it's been selected..why is there this delay? An example page is here: enlace oculto
2. After setting up my site, every url seems to have the prefix index.php/ for some reason...e.g enlace oculto name.com/index.php/the-page-i-need rather than enlace oculto name.com/the-page-i-need Why is this?
Glad to know that solution I shared works for you. I'm ending my shift here and have a good weekend.
May I kindly ask you to open a new ticket or your every new question. This will help other users searching on the forum as well as to write correctly resolution summary for which this ticket was open.