I have a custom post [seasons] (id 73). It has one post field [choose season] with 3 values [High Season, Mid Season, Low Season].
So depending on the season it must conditionally display the Price for that Season in a view.
The posts are not related.
In the view I am able to successfully display the information (as a test to see if the information can be used in the view), but I am not able to use it in a conditional output.
I attempted to use get_post(), but this was the debug output:
####################
wpv-conditional attributes
####################
Array
(
[if] => ( get_post(73) = 'Low Season' )
[debug] => true
)
####################
Debug information
####################
--------------------
Original expression: ( get_post(73) = 'Low Season' )
--------------------
Help will be greatly appreciated!
What is the link to your site?
hidden link
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
As I understand:
- You have field choose season field using which you set the current season for your custom post seasons - correct?
Now, you want to compare the current season set using choose season field using conditional statement - correct? If this is true then:
[wpv-conditional if="( '[types field="choose-season" output="raw"][/types]' eq 'Low Season' )"]
[types field="low-season-price" output="raw"][/types]
[/wpv-conditional]
[wpv-conditional if="( '[types field="choose-season" output="raw"][/types]' eq 'Mid Season' )"]
[types field="mid-season-price" output="raw"][/types]
[/wpv-conditional]
[wpv-conditional if="( '[types field="choose-season" output="raw"][/types]' eq 'High Season' )"]
[types field="high-season-price" output="raw"][/types]
[/wpv-conditional]
More info:
=> https://toolset.com/documentation/customizing-sites-using-php/functions/#numeric
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Thank you. You put me on the correct path. What worked for me was:
[wpv-conditional if="( '[types field='choose-season' id='73'][/types]' eq 'High Season' )"]From R [types field='high-season-price' output="raw"][/types] [types field='payment-per' output='raw'][/types][/wpv-conditional]
[wpv-conditional if="( '[types field='choose-season' id='73'][/types]' eq 'Mid Season' )"]From R [types field='mid-season-price' output="raw"] [/types][types field='payment-per' output='raw'][/types][/types][/wpv-conditional]
[wpv-conditional if="( '[types field='choose-season' id='73'][/types]' eq 'Low Season' )"]From R [types field='low-season-price' output="raw"] [/types][types field='payment-per' output='raw'][/types][/types][/wpv-conditional]