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]
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"?
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: hidden link
The Overall Status is set to completed, but it's still showing Episode Status.
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.
"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' )
--------------------
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]
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 (hidden link ):
####################
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 (hidden link )
####################
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
Shane
Supporter
Languages:
English (English )
Timezone:
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
My issue is resolved now. Thank you!