Hi,
i'm trying to conditionally display content in a custom template based only if a custom user field is equal to a custom post field. Following some posts I've tried this:
Working randomly doesn't sound right, as the conditional shortcode is evaluated on the server as the page is being prepared and isn't subject to the same problems that can arise running code on the front end where the run order may not be guaranteed.
Working or not working sounds more like an issue with the underlying data.
The first thing you can do is add the attribute debug="true" to the wpv-conditional shortcode, which will display some debugging info on the page that should help identify why the condition passed or failed.
Note, also, you need to be careful with single and double quotes. The if attribute argument should appear inside double quotes, meaning that all interior quotes within the argument must be single quotes (otherwise the close the if attribute prematurely). It looks like your types usermeta shortcode is using double quotes, so change those to single quotes, e.g.
thanks a lot for your suggestion. It drive me towards the final solution. It needs also the parameter current_user='true' in the types usermeta shortcode. Now it (seems) working!