Sauter la navigation

[Résolu] Conditional not showing

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

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

Ce sujet contient 8 réponses, a 3 voix.

Dernière mise à jour par duongN-3 Il y a 5 années et 11 mois.

Assisté par: Shane.

Auteur
Publications
#1194931

This code is not showing anything.
Can someone tell me what I'm doing wrong?

[wpv-conditional if="( $(wpcf-overall-status) eq 'ongoing' ) AND ( $(wpcf-overall-status) eq 'dropped' )"] 
          <li>Episode Status: [types field='episode-status' item='$current_page'][/types] </li>
          [/wpv-conditional]
#1195142

The conditional tests if a custom field 'overall-status' equals "ongoing" AND equals "dropped", at the same time. A custom field can't be equal to both values at the same time, so it's never true. Is this a field that accepts multiple values, like checkboxes group? Or is it possible you meant "OR" instead of "AND"?

#1195581

Thanks Christian!
That worked, but I have another element that I have to add.

Here's the code I have:

    [wpv-conditional if="( $(wpcf-overall-status) eq 'ongoing' ) OR ( $(wpcf-overall-status) eq 'dropped' )"] 
          <li>Episode Status: [types field='episode-status' item='$current_page'][/types] </li>
          [wpv-conditional if="( $(wpcf-overall-status) eq 'completed' )"] 
          [/wpv-conditional] 

Basically if overall-status is equal to ongoing or dropped, I want episode status to show.
If over-status is equal to completed, I want it to hide episode status.

Here's an example that I have: lien caché
The Overall Status is set to completed, but it's still showing Episode Status.

#1195644

Is the field "overall-status" applied to the current subtitle post "zettai-reido-season-3", or is it applied to another post? Turn on debug mode and simplify the conditional a bit to test it:

[wpv-conditional if="( $(wpcf-overall-status) eq 'ongoing' ) OR ( $(wpcf-overall-status) eq 'dropped' )" debug="true"] 
      <li>Episode Status: [types field='episode-status' item='$current_page'][/types] </li>
[/wpv-conditional]

Let me know the results printed to the screen in debug information.

#1195774

"overall-status" is applied to the current subtitle post "zettai-reido-season-3".

Here's the debug information:

####################
wpv-conditional attributes
####################
Array
(
    [if] => ( $(wpcf-overall-status) = 'ongoing' ) OR ( $(wpcf-overall-status) = 'dropped' )
    [debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( $(wpcf-overall-status) = 'ongoing' ) OR ( $(wpcf-overall-status) = 'dropped' )
--------------------
--------------------
Converted expression: ( '' = 'ongoing' ) OR ( '' = 'dropped' )
--------------------
#1196219

Okay let's try another test. Instead of using the $(wpcf-field-slug) syntax, use the Types field shortcode syntax with the $current_page operator:

[wpv-conditional if="( '[types field='overall-status' output='raw' id='$current_page'][/types]' eq 'ongoing' ) OR ( '[types field='overall-status' output='raw' id='$current_page'][/types]' eq 'dropped' )" debug="true"] 
      <li>Episode Status: [types field='episode-status' item='$current_page'][/types] </li>
[/wpv-conditional]
#1202875

Hi Christian.
Sorry for the late response, I've been sick.

I think that worked. Can verify for me?

Here's the debug info for a completed series (lien caché):

####################
wpv-conditional attributes
####################
Array
(
    [if] => ( 'completed' = 'ongoing' ) OR ( 'completed' = 'dropped' )
    [debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( 'completed' = 'ongoing' ) OR ( 'completed' = 'dropped' )
--------------------
After replacing 1 general variables and comparing strings: ( 'completed' = 'ongoing' ) OR ( 'completed' = 'dropped' )
	Comparing completed to ongoing
After replacing 2 general variables and comparing strings: ( 'completed' = 'ongoing' ) OR ( 'completed' = 'dropped' )
	Comparing completed to dropped

Here's an ongoing series (lien caché)

####################
wpv-conditional attributes
####################
Array
(
    [if] => ( 'ongoing' = 'ongoing' ) OR ( 'ongoing' = 'dropped' )
    [debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( 'ongoing' = 'ongoing' ) OR ( 'ongoing' = 'dropped' )
--------------------
After replacing 1 general variables and comparing strings: ( 'ongoing' = 'ongoing' ) OR ( 'ongoing' = 'dropped' )
	Comparing ongoing to ongoing
After replacing 2 general variables and comparing strings: ( 'ongoing' = 'ongoing' ) OR ( 'ongoing' = 'dropped' )
	Comparing ongoing to dropped
#1203215

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hello,

As christian is currently unavailable due to vacation I will be handling the ticket for him.

Based on the debug information your conditional is working fine, Are the values that you are expecting showing up ?

Please let me know.

Thanks,
Shane

#1209249

My issue is resolved now. Thank you!