{{visibility}} doesn't work for me

Good Morning,

I’m trying to understand the operation of the {{visibility}} handlebar, but the truth is, as much as I see examples in the forum, I can’t understand the casuistry related to this handlebar.

Specifically, I am trying to use it to differentiate: public, members and paid, as part of a class; a fairly common and habitual use.

The fact is that if I put in isolation: class="{{visibility}}" no result is shown.

Is it possible that the handlebar is conditioned to something?

Specifically, the use case is this:

<header class="site-head {{visibility}}">

Through which, I would like to identify two different states, to change their background color.

In said header, the only logic that I apply on the states is in navigation:

{{#if @member}}
  {{navigation type="secondary"}}

From what I understand, that the header does not obtain that differential logic and therefore it is possible that it is the reason why it does not give me any results.

At the moment, I am applying a workable solution to the problem:

<header class="site-head {{#if @member}}member{{else}}public{{/if}}">

But I would be very grateful if any of you could help me understand and understand more efficiently the use of {{visibility}}; especially to understand their dependence.

Thank you all for your help.

A hug.

The visibility attribute is part of the post resource, so in order to get a relevant value with {{visibility}} you have to be in the post context:

{{#post}} ... {{/post}}
{{#foreach posts}} ... {{/foreach}}
1 Like

I really appreciate your help @bironthemes, I thought that the state of privacy was also really working, from the perception of the environment.

That is, if it was a public environment, a registered user environment or a paid user environment.

But if it works in parallel with the posts, I understand that the use I wanted to give it was not consistent.

Thank you very much for helping me validate this concept, I owe you one. :call_me_hand:t3:

I remain at your disposal for what I can help you.-

1 Like