- This topic is empty.
-
AuthorPosts
-
March 27, 2019 at 7:49 pm #285571
harvey02
ParticipantHi, I am just curious if there is a css class that can hide an element if a WordPress user is logged in. I have some buttons that I only want shown if the user is logged out. I specifically need a class and not a custom function. Thanks!
March 28, 2019 at 3:52 am #285577LearnTheNew
Participanti do not know what button you want to show up. But if the user is logged in the account should be with a job role example – subscribers. What you want to show for users you can edit it in code. but the WordPress backend should not be shown as frontend.
April 5, 2019 at 3:25 pm #285996harvey02
ParticipantI would like to hide/show a button in a slider. The slider buttons settings allow me to add css classes to the button.
April 6, 2019 at 9:56 am #286008Dagny
ParticipantWhat you can do is use a function to add a class in the body if user is logged in. For example:
And then target the buttons you want to disable like this.
.logged_in .button{
display:none;
}
check if WP doesn’t automatically add classes on the body (or in any other parent) when the user is logged in where you can use them.
July 17, 2019 at 1:06 pm #293014phil1ooo
ParticipantHello
I have tried to place this into the Custom css panel but it doesn’t hide the block at all
.logged-in #panel-gb130-5d2cbb5c140e9-1-0-0 > .panel-widget-style, #panel-gb130-5d2cbb5c140e9-2-0-0 > .panel-widget-style {
display: none;
}I am SiteOrigin Editor widget within this block/single row where I want to display a message on the front page and have it removed once they login.
The above is copy/pasted from the browsers source for that block as far as I can see.
Any ideas please on how to make this work please?
Cheers
July 17, 2019 at 2:51 pm #293018phil1ooo
ParticipantIt’s OK I worked it out and got it work as it should..
Cheers
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.