I'm trying to conditionally show a field within a shortcode:
[bgc_generate_chart year="[types field='year-of-birth' output='raw'][/types]" month="[types field='month-of-birth' output='raw'][/types]" day="CODE BELOW SHOULD GO HERE" hour="[types field='hour-of-birth' output='raw'][/types]" minutes="[types field='minutes-of-birth' output='raw'][/types]" timezone="Europe/London"]
[wpv-conditional if="( $(wpcf-month-of-birth) eq '02' )"][types field='day-of-birth-29' output='raw'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-month-of-birth) eq '01' ) OR ( $(wpcf-month-of-birth) eq '03' ) OR ( $(wpcf-month-of-birth) eq '05' ) OR ( $(wpcf-month-of-birth) eq '07' ) OR ( $(wpcf-month-of-birth) eq '08' ) OR ( $(wpcf-month-of-birth) eq '10' ) OR ( $(wpcf-month-of-birth) eq '12' )"][types field='day-of-birth-31' output='raw'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-month-of-birth) eq '03' ) OR ( $(wpcf-month-of-birth) eq '06' ) OR ( $(wpcf-month-of-birth) eq '09' ) OR ( $(wpcf-month-of-birth) eq '11' )"][types field='day-of-birth-30' output='raw'][/types][/wpv-conditional]
However, it breaks the process because of the "" - I've tried day='CONDITIONAL CODE GOES HERE'
Any ideas?
Thanks in advance,
Kyle
Hi Kyle,
First, you need to register the third-party shortcode in Toolset:
https://toolset.com/documentation/legacy-features/views-plugin/shortcodes-within-shortcodes/
Then, to avoid mixup of the content when it comes to usage of " and ', try to create a custom shortcode that incorporated all the conditionals inside that shortcode:
https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-create-a-custom-shortcode/
Now you will have a clean shortcode that shows the correct data all the time and you can embed it inside an attribute.
If I miss something or did not understand the issue, I'd appreciate it if you can create a separate page with the shortcodes in question and give login information on the next reply with mode details. Make sure you set the next reply as private.
Thanks.
My issue is resolved now. Thank you!