I am trying to output a series if icons depending on the value of a usermeta field which is a multiple checkbox entry.
For example, the first checkbox option for the field named "activity" is called "presenter" and if checked contains the string "presenter". I want to test for this value an output an icon (say presenter.jpg) if the value is selected (checked).
I can't see any specific documentation on usermeta but have adapted from a custom post type solution as follows:
[wpv-conditional if="('[types usermeta='activity' option='0'][/types]' eq 'presenter' )"]
<img src="hidden link">
[/wpv-conditional]
but this doesn't work.
Hello,
I assume we are talking about a custom checkboxes user field "activity" created with Types plugin.
I have tried it in my localhost, your codes works just fine.
Please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
2) Display the "activity" user field directly, for example, if you are going to use current logged-in user as condition, you can use below shortcode:
[types usermeta='activity' option='0' user_current='true'][/types]
Check if it displays the value "presenter" correctly, then use above shortcode as condition of [wpv-conditional] shortcode, and test again.
3) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2019, and test again
Thanks a lot. I now realise I had been slightly stupid and forgotten that my field values have a capital letter at the beginning, so "Presenter" not "presenter". Code works perfectly now.
Thanks for sharing the solution.