Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Conditional If/Else on custom values

$
0
0

I have been struggling with this for some time. Trying to display a profile image and if no image display some text. I have it displaying the image properly but when i use the if to display something else if it is empty i don't get what is expected.

For the case of this example I have the following.

If a profile image exists type "happy" if it does not type "grumpy"

Here is the code as I understand it from the documentation:

wpcf-user_profile_image is the custom field that i created. I have added the wpcf- as outlined because this is a custom value created by types.

When i use my custom value on the page the image value works fine
[types usermeta="user_profile_image" size="thumbnail" align="none" resize="proportional"][/types]

When i try to use it in an if statement it doesn't seem to work?

[wpv-if f1="wpcf-user_profile_image" evaluate="empty($f1)"]grump[/wpv-if]

[wpv-if f1="wpcf-user_profile_image" evaluate="empty($f1)" condition="false" ]happy[/wpv-if]

So when i execute i get all records showing as grumpy when i know that the fields user_profile_image is propagated.

So needless to say i am stuck on the conditional statement.

Any help or guidance would be much appreciated pulling my hair out. It is a private site so to view the live page please msg me.

Thanks much!


Viewing all articles
Browse latest Browse all 20145

Trending Articles