Multiple parameters for condition

Hey

I want to hide useless content to subscribed (connected) members. For that, I have a private tag : #nomember. In order to do so, I have to check :

  • if the post has the special tag
  • if the user is a member

Easy ? No. Because I don’t know how to make that in a single statement.

{{If has tag}}
{{if is not member}}
My big chunk of code
{{else}}
Nope. You’re a member and this page is useless for you.
{{/if}}
{{else}}
The same big chunk of code
{{/if}}

That means that I always have to write my code in doble, if I want to achieve that.

Also, can I break / exit foreach blocks ?

Thanks

You can use partials to prevent code duplication.

You could also use CSS to conditionally show content. For example, you can add a body class if a user is a member, or if there’s a specific internal tag (public tags are automatically added but I don’t think internal tags are)

Then you could add a rule like .is-paid-member .non-paid-member-content {display: none}.

  • NOTE: don’t do this for content that should be visible to [paid] members only!