Hello!
I’m using this CSS class to hide things for logged out users but isn’t working for hivepress
// Add CSS class for logged in and logged out users
add_filter('body_class','er_logged_in_filter');
function er_logged_in_filter($classes) {
if( is_user_logged_in() ) {
$classes[] = 'logged-in-condition';
} else {
$classes[] = 'logged-out-condition';
}
// return the $classes array
return $classes;
}
Seegon
January 18, 2023, 7:31pm
2
Think it does this by default. It adds the class “logged-in” to the body. You don’t need a class for logged-out, as the absent of “logged-in” means the user is logged out
So can you can give me a solution to hide Hivepress search form, listenings, listening categories and vendors from users who aren’t sign in yet?
I am a starter in wordpress, i took that css from a tutorial and it works for wordpress default text, photos, etc.
Thank’s
Seegon
January 18, 2023, 9:44pm
4
Then you need to use something else than CSS, because that can be reverse engineered in the browser.
You need to prevent it from being accessible with some php snippets i think.
andrii
January 19, 2023, 6:21pm
7
Hi,
Please try this CSS snippet:
body:not(.logged-in) .hp-form--listing-search{
display: none;
}
Please note that it hides it on the page, so those who know how to use DevTools will still be able to search.
system
Closed
February 19, 2023, 12:36pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.