Hi, I am trying to use a CONTAINS operator inside the wpv-conditional shortcode. Here's my example:
[wpv-conditional if="('[types usermeta='my-custom-user-checkboxlist' separator=', ' current_user='true'][/types]' CONTAINS '[wpv-post-taxonomy type='my-custom-post-taxonomy' separator=', ' format='slug']')"]...[/wpv-conditional]
Unfortunately that does not work. Is there a way to achieve that with the wpv-conditional shortcode? Please see my attached debug information.
Hi Minesh, thank you for this piece of information. I was able to do build my condition as follows:
[wpv-conditional if="( CONTAINS(#(ausbildungsmodul),'[types usermeta='user-ausbildungsmodule' option="0" current_user='true'][/types]') OR CONTAINS(#(ausbildungsmodul),'[types usermeta='user-ausbildungsmodule' option="1" current_user='true'][/types]') OR CONTAINS(#(ausbildungsmodul),'[types usermeta='user-ausbildungsmodule' option="2" current_user='true'][/types]') OR CONTAINS(#(ausbildungsmodul),'[types usermeta='user-ausbildungsmodule' option="3" current_user='true'][/types]') OR CONTAINS(#(ausbildungsmodul),'[types usermeta='user-ausbildungsmodule' option="4" current_user='true'][/types]') )"]<p>...</p>[/wpv-conditional]
This way I check if the post taxonomy contains a certain term which comes from a custom user field from the current_user. As this custom user field is a list of checkboxes I need to check each option with an OR operator. It works for me. One last question: Do you see a more elegant/shorter way to achieve this?
No- there is no other workaround. Maybe another possible solution should be custom shortcode but again that you will need to write the custom shortcode code as per your requirement.