So I want to hide certain items if a user is not logged into the website. I already have a custom lightswitch field on each of the items but I'm not sure on how to write the code for it. Can anyone help?
Asked
Active
Viewed 116 times
1 Answers
3
Based on https://craftcms.com/docs/lightswitch-fields and https://craftcms.stackexchange.com/a/352/5134:
{% if entry.lightswitchFieldHandle %}
{% if currentUser %}
Display entry that only logged users can see
{% endif %}
{% else %}
Display entry that anyone can see
{% endif %}
-
How can I display the entry? – JustinTheeDude Aug 12 '16 at 22:16