Hide Custom Header Links from anon

Great theme component. Thank you.

Is there a way to hide the links if the user has to login to view the site content?
This is what my site looks like on the login page with the theme enabled.

image

2 Likes

Until there is a cleaner way to do it via an upgrade of the component, you can add this css lines in your theme

.anon .custom-header-links {
    display: none;
}
7 Likes

This works a treat!!!

If any of you amazing coders out there could add the ability per link to make visible to

  1. logged in users or
  2. anon (eg not logged in) users or
  3. all users

we would be extremely grateful!!!

2 Likes

Everything is still doable via css, but you have to create a line for each link which can take some time.

If we take the demo for this component :

I’ll try your 3 scenarios with the Tech example.

Ex #1 visible to logged in users

.anon .headerLink.tech {
    display: none;
}

Ex #2 visible to not logged in users

.headerLink.tech {
    display: none;
}
.anon .headerLink.tech {
    display: inline-block;
}

Ex #3 visible to all users : don’t add anything


Replace text with the key word of your menu.

I’ll take a last example to help you. The css class to use for the item menu Your Vote Counts! is .headerLink.your-vote-counts

9 Likes